Files
CMake/Tests/RunCMake/try_compile/CMP0137-Common.cmake
Brad King a6562ff579 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
2022-05-16 10:47:21 -04:00

17 lines
584 B
CMake

set(CMAKE_ENABLE_EXPORTS 1)
set(FOO 2)
set(CMAKE_TRY_COMPILE_PLATFORM_VARIABLES FOO)
try_compile(RESULT_VAR
${CMAKE_CURRENT_BINARY_DIR}/CMP0137-build
${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)