From 6abd25e7fd70ed1ac38cfc8ce9a5a8c7b05f7c51 Mon Sep 17 00:00:00 2001 From: "Sung, Po Han" Date: Thu, 28 Mar 2024 10:42:38 +0800 Subject: Help: Fix a typo --- Help/policy/CMP0066.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Help/policy/CMP0066.rst b/Help/policy/CMP0066.rst index fa4bc5c..947a186 100644 --- a/Help/policy/CMP0066.rst +++ b/Help/policy/CMP0066.rst @@ -18,7 +18,7 @@ variables like :variable:`CMAKE__FLAGS_DEBUG` and only use CMake's built-in defaults for the current compiler and platform. The ``NEW`` behavior of this policy is to honor config-specific flag -variabldes like :variable:`CMAKE__FLAGS_DEBUG`. +variables like :variable:`CMAKE__FLAGS_DEBUG`. .. |INTRODUCED_IN_CMAKE_VERSION| replace:: 3.7 .. |WARNS_OR_DOES_NOT_WARN| replace:: does *not* warn by default -- cgit v0.12 From e60281e9687d5192bb4f804d0194ad4d3a4a619e Mon Sep 17 00:00:00 2001 From: "Sung, Po Han" Date: Thu, 28 Mar 2024 10:47:45 +0800 Subject: CMakeDetermineCompilerABI: Remove -Werror from per-config flags Extend the fixes from * commit 079ea66468 (CMakeDetermineCompilerABI: Handle NVCC-style -Werror flags, 2020-10-04, v3.19.0-rc1~45^2), and * commit cec6f98018 (CMakeDetermineCompilerABI: Avoid removing the flag after -Werror, 2023-05-29, v3.26.5~4^2) to apply to the per-config flags propagated by CMP0066's NEW behavior. --- Modules/CMakeDetermineCompilerABI.cmake | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/Modules/CMakeDetermineCompilerABI.cmake b/Modules/CMakeDetermineCompilerABI.cmake index 012a87c..cb2162c 100644 --- a/Modules/CMakeDetermineCompilerABI.cmake +++ b/Modules/CMakeDetermineCompilerABI.cmake @@ -50,7 +50,14 @@ function(CMAKE_DETERMINE_COMPILER_ABI lang src) __TestCompiler_setTryCompileTargetType() # Avoid failing ABI detection on warnings. - string(REGEX REPLACE "(^| )-Werror([= ][^-][^ ]*)?( |$)" " " CMAKE_${lang}_FLAGS "${CMAKE_${lang}_FLAGS}") + if(CMAKE_TRY_COMPILE_CONFIGURATION) + string(TOUPPER "${CMAKE_TRY_COMPILE_CONFIGURATION}" _tc_config) + else() + set(_tc_config "DEBUG") + endif() + foreach(v CMAKE_${lang}_FLAGS CMAKE_${lang}_FLAGS_${_tc_config}) + string(REGEX REPLACE "(^| )-Werror([= ][^-][^ ]*)?( |$)" " " ${v} "${${v}}") + endforeach() # Save the current LC_ALL, LC_MESSAGES, and LANG environment variables # and set them to "C" that way GCC's "search starts here" text is in -- cgit v0.12 From 06c99ce73bded55232dad5e7db85bc4740cb45fb Mon Sep 17 00:00:00 2001 From: "Sung, Po Han" Date: Thu, 28 Mar 2024 10:58:07 +0800 Subject: CheckSymbolExists: Avoid removing the flag after -Werror In commit 1ab7c3cd28 (CheckSymbolExists: Work around GCC failure with -pedantic-errors option, 2021-10-22, v3.23.0-rc1~498^2) we used the same code that was fixed by commit cec6f98018 (CMakeDetermineCompilerABI: Avoid removing the flag after -Werror, 2023-05-29, v3.26.5~4^2). Apply the fix to CheckSymbolExists too. --- Modules/CheckSymbolExists.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Modules/CheckSymbolExists.cmake b/Modules/CheckSymbolExists.cmake index 931ed4a..90f91dd 100644 --- a/Modules/CheckSymbolExists.cmake +++ b/Modules/CheckSymbolExists.cmake @@ -76,7 +76,7 @@ endmacro() macro(__CHECK_SYMBOL_EXISTS_FILTER_FLAGS LANG) set(__CMAKE_${LANG}_FLAGS_SAVED "${CMAKE_${LANG}_FLAGS}") - string(REGEX REPLACE "(^| )-Werror([= ][^ ]*)?( |$)" " " CMAKE_${LANG}_FLAGS "${CMAKE_${LANG}_FLAGS}") + string(REGEX REPLACE "(^| )-Werror([= ][^-][^ ]*)?( |$)" " " CMAKE_${LANG}_FLAGS "${CMAKE_${LANG}_FLAGS}") string(REGEX REPLACE "(^| )-pedantic-errors( |$)" " " CMAKE_${LANG}_FLAGS "${CMAKE_${LANG}_FLAGS}") endmacro() -- cgit v0.12 From cebcc07a80c5934e082b597604a753cce456020c Mon Sep 17 00:00:00 2001 From: "Sung, Po Han" Date: Thu, 28 Mar 2024 11:02:20 +0800 Subject: CheckSymbolExists: Remove -Werror from per-config flags Extend the fix from commit 1ab7c3cd28 (CheckSymbolExists: Work around GCC failure with -pedantic-errors option, 2021-10-22, v3.23.0-rc1~498^2) to apply to the per-config flags propagated by CMP0066's NEW behavior. --- Modules/CheckSymbolExists.cmake | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/Modules/CheckSymbolExists.cmake b/Modules/CheckSymbolExists.cmake index 90f91dd..621df75 100644 --- a/Modules/CheckSymbolExists.cmake +++ b/Modules/CheckSymbolExists.cmake @@ -75,14 +75,28 @@ macro(CHECK_SYMBOL_EXISTS SYMBOL FILES VARIABLE) endmacro() macro(__CHECK_SYMBOL_EXISTS_FILTER_FLAGS LANG) - set(__CMAKE_${LANG}_FLAGS_SAVED "${CMAKE_${LANG}_FLAGS}") - string(REGEX REPLACE "(^| )-Werror([= ][^-][^ ]*)?( |$)" " " CMAKE_${LANG}_FLAGS "${CMAKE_${LANG}_FLAGS}") - string(REGEX REPLACE "(^| )-pedantic-errors( |$)" " " CMAKE_${LANG}_FLAGS "${CMAKE_${LANG}_FLAGS}") + if(CMAKE_TRY_COMPILE_CONFIGURATION) + string(TOUPPER "${CMAKE_TRY_COMPILE_CONFIGURATION}" _tc_config) + else() + set(_tc_config "DEBUG") + endif() + foreach(v CMAKE_${LANG}_FLAGS CMAKE_${LANG}_FLAGS_${_tc_config}) + set(__${v}_SAVED "${${v}}") + string(REGEX REPLACE "(^| )-Werror([= ][^-][^ ]*)?( |$)" " " ${v} "${${v}}") + string(REGEX REPLACE "(^| )-pedantic-errors( |$)" " " ${v} "${${v}}") + endforeach() endmacro() macro(__CHECK_SYMBOL_EXISTS_RESTORE_FLAGS LANG) - set(CMAKE_${LANG}_FLAGS "${__CMAKE_${LANG}_FLAGS_SAVED}") - unset(__CMAKE_${LANG}_FLAGS_SAVED) + if(CMAKE_TRY_COMPILE_CONFIGURATION) + string(TOUPPER "${CMAKE_TRY_COMPILE_CONFIGURATION}" _tc_config) + else() + set(_tc_config "DEBUG") + endif() + foreach(v CMAKE_${LANG}_FLAGS CMAKE_${LANG}_FLAGS_${_tc_config}) + set(${v} "${__${v}_SAVED}") + unset(__${v}_SAVED) + endforeach() endmacro() macro(__CHECK_SYMBOL_EXISTS_IMPL SOURCEFILE SYMBOL FILES VARIABLE) -- cgit v0.12