From: Viktor Szakats Date: Mon, 14 Apr 2025 22:38:49 +0000 (+0200) Subject: cmake: append picky warnings to `CMAKE_REQUIRED_FLAGS` as string X-Git-Tag: curl-8_14_0~303 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=111b58fbb66aa6bf9aa4d31fc5b0705906120542;p=thirdparty%2Fcurl.git cmake: append picky warnings to `CMAKE_REQUIRED_FLAGS` as string Also: - drop unnecessary type conversion. `CMAKE_REQUIRED_FLAGS` is already space-separated. https://cmake.org/cmake/help/latest/module/CheckCSourceCompiles.html Follow-up to e86542038dda88dadf8959584e803895f979310c #17047 Closes #17055 --- diff --git a/CMake/Macros.cmake b/CMake/Macros.cmake index 14b82c309e..e3a654b5f3 100644 --- a/CMake/Macros.cmake +++ b/CMake/Macros.cmake @@ -40,7 +40,6 @@ set(CURL_TEST_DEFINES "") # Initialize global variable # Return result in variable: CURL_TEST_OUTPUT macro(curl_internal_test _curl_test) if(NOT DEFINED "${_curl_test}") - string(REPLACE ";" " " _cmake_required_flags "${CMAKE_REQUIRED_FLAGS}") string(REPLACE ";" " " _cmake_required_definitions "${CMAKE_REQUIRED_DEFINITIONS}") set(_curl_test_add_libraries "") if(CMAKE_REQUIRED_LIBRARIES) @@ -53,7 +52,7 @@ macro(curl_internal_test _curl_test) ${PROJECT_BINARY_DIR} "${CMAKE_CURRENT_SOURCE_DIR}/CMake/CurlTests.c" CMAKE_FLAGS - "-DCOMPILE_DEFINITIONS:STRING=-D${_curl_test} ${CURL_TEST_DEFINES} ${_cmake_required_flags} ${_cmake_required_definitions}" + "-DCOMPILE_DEFINITIONS:STRING=-D${_curl_test} ${CURL_TEST_DEFINES} ${CMAKE_REQUIRED_FLAGS} ${_cmake_required_definitions}" "${_curl_test_add_libraries}" OUTPUT_VARIABLE CURL_TEST_OUTPUT) if(${_curl_test}) diff --git a/CMake/PickyWarnings.cmake b/CMake/PickyWarnings.cmake index e2af24e4e5..70641763eb 100644 --- a/CMake/PickyWarnings.cmake +++ b/CMake/PickyWarnings.cmake @@ -298,7 +298,7 @@ if(_picky) # Apply to all feature checks list(REMOVE_ITEM _picky "-pedantic-errors") # Must not pass to feature checks string(REPLACE ";" " " _picky_tmp "${_picky}") - list(APPEND CMAKE_REQUIRED_FLAGS "${_picky_tmp}") + string(APPEND CMAKE_REQUIRED_FLAGS " ${_picky_tmp}") unset(_picky) unset(_picky_tmp)