1
0
mirror of https://github.com/Kitware/CMake.git synced 2025-10-15 20:46:37 +08:00

Tests: Isolate RunCMake.LinkWarningAsError from -Werror flags in environment

Fixes: #26836
This commit is contained in:
Brad King
2025-04-03 15:12:26 -04:00
parent 3e4519a4e3
commit 2f9211b4e4

View File

@@ -1,5 +1,15 @@
include(RunCMake)
# Isolate test cases from the caller's environment.
if(DEFINED ENV{CFLAGS})
string(REGEX REPLACE "-Werror[^ ]*" "" cflags "$ENV{CFLAGS}")
set(ENV{CFLAGS} "${cflags}")
endif()
if(DEFINED ENV{LDFLAGS})
string(REGEX REPLACE "-Wl,--fatal-warnings[^ ]*" "" ldflags "$ENV{LDFLAGS}")
set(ENV{LDFLAGS} "${ldflags}")
endif()
run_cmake(BadValue)
function(run_link_warn test)