Files
CMake/Tests/RunCMake/ToolchainFile/RunCMakeTest.cmake
Brad King bd16a985fc CompilerId/Features: Tolerate variables named for languages
If a `CMakeLists.txt` or `CMAKE_TOOLCHAIN_FILE` sets a variable named
`C`, `CXX`, or `CUDA`, we were previously comparing each enabled
language name to the value of that variable, rather than the name
itself.  Double-quote the string to take advantage of policy `CMP0054`,
but also add "x" prefixes to support projects that do not set the
policy.

Fixes: #22125
2021-05-03 10:22:23 -04:00

22 lines
699 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)
run_cmake_toolchain(CheckLanguage)
run_cmake_toolchain(FlagsInit)
run_cmake_toolchain(LangVars)
run_cmake_toolchain(LinkFlagsInit)
function(run_IncludeDirectories)
run_cmake_toolchain(IncludeDirectories)
set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/IncludeDirectories-build)
set(RunCMake_TEST_NO_CLEAN 1)
run_cmake_command(IncludeDirectories-build ${CMAKE_COMMAND} --build . --config Debug)
endfunction()
run_IncludeDirectories()