diff options
author | Brad King <brad.king@kitware.com> | 2023-06-23 15:01:02 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2023-06-23 15:01:09 (GMT) |
commit | 483c971940836043c3189aef3cff2a22d264ae8e (patch) | |
tree | b488d83073939f216cda939726582e2df167c931 | |
parent | 4995017c2611d264355ed4d220bb2e5b284639cf (diff) | |
parent | 97d0f764536ec46c78f1b2c2bb02de9b730693b9 (diff) | |
download | CMake-483c971940836043c3189aef3cff2a22d264ae8e.zip CMake-483c971940836043c3189aef3cff2a22d264ae8e.tar.gz CMake-483c971940836043c3189aef3cff2a22d264ae8e.tar.bz2 |
Merge topic 'FindCURL-static'
97d0f76453 FindCURL: add a CURL_USE_STATIC_LIBS hint
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !8573
-rw-r--r-- | Help/release/dev/FindCURL-static.rst | 5 | ||||
-rw-r--r-- | Modules/FindCURL.cmake | 23 |
2 files changed, 28 insertions, 0 deletions
diff --git a/Help/release/dev/FindCURL-static.rst b/Help/release/dev/FindCURL-static.rst new file mode 100644 index 0000000..3c369d2 --- /dev/null +++ b/Help/release/dev/FindCURL-static.rst @@ -0,0 +1,5 @@ +FindCURL-static +--------------- + +* The :module:`FindCURL` module gained a ``CURL_USE_STATIC_LIBS`` hint + to select static libraries. diff --git a/Modules/FindCURL.cmake b/Modules/FindCURL.cmake index acb87dc..2f33dac 100644 --- a/Modules/FindCURL.cmake +++ b/Modules/FindCURL.cmake @@ -58,6 +58,18 @@ returns its results with no further action. Set ``CURL_NO_CURL_CMAKE`` to ``ON`` to disable this search. +Hints +^^^^^ + +``CURL_USE_STATIC_LIBS`` + + .. versionadded:: 3.28 + + Set to ``TRUE`` to use static libraries. + + This is meaningful only when CURL is not found via its + CMake Package Configuration file. + #]=======================================================================] include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) @@ -193,6 +205,11 @@ if(CURL_FOUND) set_target_properties(CURL::libcurl PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${CURL_INCLUDE_DIRS}") + if(CURL_USE_STATIC_LIBS) + set_property(TARGET CURL::libcurl APPEND PROPERTY + INTERFACE_COMPILE_DEFINITIONS "CURL_STATICLIB") + endif() + if(EXISTS "${CURL_LIBRARY}") set_target_properties(CURL::libcurl PROPERTIES IMPORTED_LINK_INTERFACE_LANGUAGES "C" @@ -212,5 +229,11 @@ if(CURL_FOUND) IMPORTED_LINK_INTERFACE_LANGUAGES "C" IMPORTED_LOCATION_DEBUG "${CURL_LIBRARY_DEBUG}") endif() + + if(CURL_USE_STATIC_LIBS AND MSVC) + set_target_properties(CURL::libcurl PROPERTIES + INTERFACE_LINK_LIBRARIES "normaliz.lib;ws2_32.lib;wldap32.lib") + endif() + endif() endif() |