curlcpp icon indicating copy to clipboard operation
curlcpp copied to clipboard

BUILD_SHARED_LIBS non-standard usage.

Open MitchellBot opened this issue 2 years ago • 0 comments

While building a SHARED lib version of curlcpp, we noticed that the src/CMakeLists.txt file utilizes the CMake variable ${BUILD_SHARED_LIBS} in a non-standard way. i.e., according to their documentation, this should be a boolean value. The src/CMakeLists.txt treats it that way initially (if(NOT BUILD_SHARED_LIBS)) but then in the add_library call, it treats it as a string add_library(curlcpp ${BUILD_SHARED_LIBS} as the add_library function expects one of [SHARED, STATIC, INTERFACE, MODULE]. This causes the build to fail as add_library(curlcpp ON ... is not a valid call resulting in the error "Cannot find source file: ON".

Note that this entire if block is unnecessary as BUILD_SHARED_LIBS is a global cmake variable. add_library can be called without the modifier and if BUILD_SHARED_LIBS is set, you will get a SHARED library, otherwise you will get a STATIC library.

MitchellBot avatar Dec 07 '23 17:12 MitchellBot