CMake/Tests/RunCMake/ToolchainFile/RunCMakeTest.cmake
Brad King 72e0dc58d3 Diagnose recursive project/enable_language without crashing (#15999)
Calling `project()` or `enable_language()` from a toolchain file will
infinitely recurse since those commands load the toolchain file.
Diagnose and reject this case with an error message instead of crashing
when the stack eventually overflows.
2016-03-07 13:52:38 -05:00

10 lines
253 B
CMake

include(RunCMake)
function(run_cmake_toolchain t)
set(RunCMake_TEST_OPTIONS -DCMAKE_TOOLCHAIN_FILE=${RunCMake_SOURCE_DIR}/${t}-toolchain.cmake)
run_cmake(${t})
endfunction()
run_cmake_toolchain(CallEnableLanguage)
run_cmake_toolchain(CallProject)