diff options
author | Brad King <brad.king@kitware.com> | 2022-05-16 14:16:34 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2022-05-16 14:47:21 (GMT) |
commit | a6562ff57908e6f03ef44eb0438ba9937f28174c (patch) | |
tree | 66891e45efadaa7589705021e66d96a476088e82 /Tests | |
parent | 4843a376767c2c4b46e29ed85ac823443317ca40 (diff) | |
download | CMake-a6562ff57908e6f03ef44eb0438ba9937f28174c.zip CMake-a6562ff57908e6f03ef44eb0438ba9937f28174c.tar.gz CMake-a6562ff57908e6f03ef44eb0438ba9937f28174c.tar.bz2 |
try_compile: Add option to skip passing platform variables
Add a `CMAKE_TRY_COMPILE_NO_PLATFORM_VARIABLES` variable to tell
`try_compile` not to pass platform variables to the test project.
Issue: #23219
Diffstat (limited to 'Tests')
-rw-r--r-- | Tests/RunCMake/try_compile/CMP0137-Common.cmake | 8 | ||||
-rw-r--r-- | Tests/RunCMake/try_compile/CMP0137-NEW-stdout.txt | 3 | ||||
-rw-r--r-- | Tests/RunCMake/try_compile/CMP0137-WARN-stdout.txt | 3 |
3 files changed, 14 insertions, 0 deletions
diff --git a/Tests/RunCMake/try_compile/CMP0137-Common.cmake b/Tests/RunCMake/try_compile/CMP0137-Common.cmake index 867475d..2c1bc0d 100644 --- a/Tests/RunCMake/try_compile/CMP0137-Common.cmake +++ b/Tests/RunCMake/try_compile/CMP0137-Common.cmake @@ -6,3 +6,11 @@ try_compile(RESULT_VAR ${CMAKE_CURRENT_SOURCE_DIR}/CMP0137 TestCMP0137) include(${CMAKE_CURRENT_BINARY_DIR}/CMP0137-build/info.cmake OPTIONAL) + +message(STATUS "Enabling CMAKE_TRY_COMPILE_NO_PLATFORM_VARIABLES") +set(CMAKE_TRY_COMPILE_NO_PLATFORM_VARIABLES 1) +try_compile(RESULT_VAR + ${CMAKE_CURRENT_BINARY_DIR}/CMP0137-build2 + ${CMAKE_CURRENT_SOURCE_DIR}/CMP0137 + TestCMP0137) +include(${CMAKE_CURRENT_BINARY_DIR}/CMP0137-build2/info.cmake OPTIONAL) diff --git a/Tests/RunCMake/try_compile/CMP0137-NEW-stdout.txt b/Tests/RunCMake/try_compile/CMP0137-NEW-stdout.txt index 0a6bb38..abc61dc 100644 --- a/Tests/RunCMake/try_compile/CMP0137-NEW-stdout.txt +++ b/Tests/RunCMake/try_compile/CMP0137-NEW-stdout.txt @@ -1,2 +1,5 @@ -- CMAKE_ENABLE_EXPORTS='1' -- FOO='2' +-- Enabling CMAKE_TRY_COMPILE_NO_PLATFORM_VARIABLES +-- CMAKE_ENABLE_EXPORTS='' +-- FOO='' diff --git a/Tests/RunCMake/try_compile/CMP0137-WARN-stdout.txt b/Tests/RunCMake/try_compile/CMP0137-WARN-stdout.txt index fda1e41..2e4bebe 100644 --- a/Tests/RunCMake/try_compile/CMP0137-WARN-stdout.txt +++ b/Tests/RunCMake/try_compile/CMP0137-WARN-stdout.txt @@ -1,2 +1,5 @@ -- CMAKE_ENABLE_EXPORTS='' -- FOO='' +-- Enabling CMAKE_TRY_COMPILE_NO_PLATFORM_VARIABLES +-- CMAKE_ENABLE_EXPORTS='' +-- FOO='' |