diff --git a/docs/INSTALL-CMAKE.md b/docs/INSTALL-CMAKE.md index 8f19c51cc9..e55d951496 100644 --- a/docs/INSTALL-CMAKE.md +++ b/docs/INSTALL-CMAKE.md @@ -170,6 +170,7 @@ assumes that CMake generates `Makefile`: - `IMPORT_LIB_SUFFIX`: Import library suffix. Default: `_imp` for MSVC-like toolchains, otherwise empty. - `LIBCURL_OUTPUT_NAME`: Basename of the curl library. Default: `libcurl` - `PICKY_COMPILER`: Enable picky compiler options. Default: `ON` +- `SHARE_LIB_OBJECT`: Build shared and static libcurl in a single pass (requires CMake 3.12 or newer). Default: `ON` for Windows - `STATIC_LIB_SUFFIX`: Static library suffix. Default: (empty) ## CA bundle options diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt index 244835814a..76b63f416b 100644 --- a/lib/CMakeLists.txt +++ b/lib/CMakeLists.txt @@ -106,9 +106,9 @@ if(NOT DEFINED SHARE_LIB_OBJECT) endif() endif() -if(SHARE_LIB_OBJECT) +if(SHARE_LIB_OBJECT AND NOT CMAKE_VERSION VERSION_LESS 3.12) set(LIB_OBJECT "libcurl_object") - add_library(${LIB_OBJECT} OBJECT ${HHEADERS} ${CSOURCES}) + add_library(${LIB_OBJECT} OBJECT ${HHEADERS} ${CSOURCES}) # Requires CMake 3.12 if(WIN32) # Define CURL_STATICLIB always, to disable __declspec(dllexport) for # exported libcurl symbols. We handle exports via libcurl.def instead.