]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
cmake: add comments to feature check options applied globally
authorViktor Szakats <commit@vsz.me>
Sat, 5 Oct 2024 11:59:28 +0000 (13:59 +0200)
committerViktor Szakats <commit@vsz.me>
Thu, 10 Oct 2024 17:36:04 +0000 (19:36 +0200)
Add comments saying when we want values set in feature check option
variables to apply to all feature checks, globally. These are currently:
`ws2_32` and `socket` libraries, and `-D_WIN32_WINNT=` macro.

Also use `list(APPEND ...)` for the libraries to avoid overwriting
potentially existing values.

Cherry-picked from #15157
Closes #15253

CMake/Macros.cmake
CMakeLists.txt

index 3ed0a4982560028f06712693989d319d91e2fd88..62e0898df714ff24054847719e8e1d5fcacd690e 100644 (file)
@@ -31,7 +31,7 @@ macro(check_include_file_concat _file _variable)
   check_include_files("${CURL_INCLUDES};${_file}" ${_variable})
   if(${_variable})
     set(CURL_INCLUDES ${CURL_INCLUDES} ${_file})
-    set(CURL_TEST_DEFINES "${CURL_TEST_DEFINES} -D${_variable}")
+    set(CURL_TEST_DEFINES "${CURL_TEST_DEFINES} -D${_variable}")  # Apply to curl_internal_test()
   endif()
 endmacro()
 
index 3594be790a2dcd8563479a54bb0a43944d2c59dd..29f17fb659da84cb43d94de9c422da139af991eb 100644 (file)
@@ -168,8 +168,8 @@ if(WIN32)
   set(CURL_TARGET_WINDOWS_VERSION "" CACHE STRING "Minimum target Windows version as hex string")
   if(CURL_TARGET_WINDOWS_VERSION)
     add_definitions("-D_WIN32_WINNT=${CURL_TARGET_WINDOWS_VERSION}")
-    list(APPEND CMAKE_REQUIRED_DEFINITIONS "-D_WIN32_WINNT=${CURL_TARGET_WINDOWS_VERSION}")
-    set(CURL_TEST_DEFINES "${CURL_TEST_DEFINES} -D_WIN32_WINNT=${CURL_TARGET_WINDOWS_VERSION}")
+    list(APPEND CMAKE_REQUIRED_DEFINITIONS "-D_WIN32_WINNT=${CURL_TARGET_WINDOWS_VERSION}")  # Apply to all feature checks
+    set(CURL_TEST_DEFINES "${CURL_TEST_DEFINES} -D_WIN32_WINNT=${CURL_TARGET_WINDOWS_VERSION}")  # Apply to curl_internal_test()
   endif()
 
   # Detect actual value of _WIN32_WINNT and store as HAVE_WIN32_WINNT
@@ -1490,9 +1490,9 @@ endif()
 
 # Check for some functions that are used
 if(WIN32)
-  set(CMAKE_REQUIRED_LIBRARIES "ws2_32")
+  list(APPEND CMAKE_REQUIRED_LIBRARIES "ws2_32")  # Apply to all feature checks
 elseif(HAVE_LIBSOCKET)
-  set(CMAKE_REQUIRED_LIBRARIES "socket")
+  list(APPEND CMAKE_REQUIRED_LIBRARIES "socket")  # Apply to all feature checks
 endif()
 
 check_symbol_exists("fnmatch"         "${CURL_INCLUDES};fnmatch.h" HAVE_FNMATCH)