mirror of
https://github.com/Kitware/CMake.git
synced 2026-02-20 06:00:30 -06:00
Add a `CMAKE_TRY_COMPILE_NO_PLATFORM_VARIABLES` variable to tell `try_compile` not to pass platform variables to the test project. Issue: #23219
17 lines
584 B
CMake
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)
|