]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
cmake: honor `CMAKE_C_FLAGS` in test 1119 and 1167
authorViktor Szakats <commit@vsz.me>
Mon, 18 Aug 2025 08:19:45 +0000 (10:19 +0200)
committerViktor Szakats <commit@vsz.me>
Mon, 18 Aug 2025 09:08:53 +0000 (11:08 +0200)
`CMAKE_C_FLAGS` is not set by curl, but may contain custom options
required for a successful compiler run, when invoked by these tests.

One such case is when configuring Visual Studio or clang-cl via compiler
options, instead of envs.

Cherry-picked from #18301
Closes #18307

tests/CMakeLists.txt

index 014fe0db873f85f90d315ce8d68a978f3c9138d4..0593b513ee51c6687e5c76ff9ff9f76088e8fd60 100644 (file)
@@ -104,6 +104,7 @@ if(MSVC OR CMAKE_C_COMPILER_ID STREQUAL "GNU" OR CMAKE_C_COMPILER_ID MATCHES "Cl
   if(APPLE AND CMAKE_OSX_SYSROOT)
     string(APPEND CURL_CPP " -isysroot ${CMAKE_OSX_SYSROOT}")
   endif()
+  string(APPEND CURL_CPP " ${CMAKE_C_FLAGS}")
   # Add header directories, like autotools builds do.
   get_property(_include_dirs TARGET ${LIB_SELECTED} PROPERTY INCLUDE_DIRECTORIES)
   foreach(_include_dir IN LISTS _include_dirs)