← Commit list

49ef2f8d1e

Viktor Szakats
Viktor Szakats
2025-11-09
SUCCESS Duration: 142s

Subject

cmake: adjust defaults for target platforms not supporting shared libs

Binary

No binary (build failed)

Architecture & Compiler Flags

Architecture: x86_64-linux-gnu Compiler: gcc (Ubuntu 11.4.0-1ubuntu1~22.04.3) 11.4.0

—

Build Log

(log yok)

Commit Diff GitHub →

CMakeLists.txt+3 -2
@@ -204,7 +204,8 @@ endif()
option(CURL_WERROR "Turn compiler warnings into errors" OFF)
option(PICKY_COMPILER "Enable picky compiler options" ON)
option(BUILD_CURL_EXE "Build curl executable" ON)
-option(BUILD_SHARED_LIBS "Build shared libraries" ON)
+get_property(_has_shared GLOBAL PROPERTY TARGET_SUPPORTS_SHARED_LIBS)
+option(BUILD_SHARED_LIBS "Build shared libraries" ${_has_shared})
option(BUILD_STATIC_LIBS "Build static libraries" OFF)
option(BUILD_STATIC_CURL "Build curl executable with static libcurl" OFF)
option(ENABLE_ARES "Enable c-ares support" OFF)
@@ -260,7 +261,7 @@ if(WIN32)
endif()
unset(MINGW64_VERSION CACHE) # Avoid storing in CMake cache
endif()
-elseif(DOS OR AMIGA)
+elseif(DOS)
set(BUILD_SHARED_LIBS OFF)
set(BUILD_STATIC_LIBS ON)
endif()
docs/INSTALL-CMAKE.md+1 -1
@@ -221,7 +221,7 @@ target_link_libraries(my_target PRIVATE CURL::libcurl)
- `BUILD_EXAMPLES`: Build libcurl examples. Default: `ON`
- `BUILD_LIBCURL_DOCS`: Build libcurl man pages. Default: `ON`
- `BUILD_MISC_DOCS`: Build misc man pages (e.g. `curl-config` and `mk-ca-bundle`). Default: `ON`
-- `BUILD_SHARED_LIBS`: Build shared libraries. Default: `ON`
+- `BUILD_SHARED_LIBS`: Build shared libraries. Default: `ON` (if target platform supports shared libs, otherwise `OFF`)
- `BUILD_STATIC_CURL`: Build curl executable with static libcurl. Default: `OFF` (turns to `ON`, when building static libcurl only)
- `BUILD_STATIC_LIBS`: Build static libraries. Default: `OFF` (turns to `ON` if `BUILD_SHARED_LIBS` is `OFF`)
- `BUILD_TESTING`: Build tests. Default: `ON`