diff options
author | Brad King <brad.king@kitware.com> | 2021-04-28 18:37:51 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2021-05-03 14:22:23 (GMT) |
commit | bd16a985fcc26a2138e20ed11c248cd716eb5497 (patch) | |
tree | dc80e9edd83ec8a0f70f6568e4f5990958d84956 /Modules/CMakeCompilerIdDetection.cmake | |
parent | 49c6d0f26199c252b493ed5f816dbcb2e9701112 (diff) | |
download | CMake-bd16a985fcc26a2138e20ed11c248cd716eb5497.zip CMake-bd16a985fcc26a2138e20ed11c248cd716eb5497.tar.gz CMake-bd16a985fcc26a2138e20ed11c248cd716eb5497.tar.bz2 |
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
Diffstat (limited to 'Modules/CMakeCompilerIdDetection.cmake')
-rw-r--r-- | Modules/CMakeCompilerIdDetection.cmake | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/Modules/CMakeCompilerIdDetection.cmake b/Modules/CMakeCompilerIdDetection.cmake index c79d423..850fc14 100644 --- a/Modules/CMakeCompilerIdDetection.cmake +++ b/Modules/CMakeCompilerIdDetection.cmake @@ -18,7 +18,7 @@ function(compiler_id_detection outvar lang) file(GLOB lang_files "${CMAKE_ROOT}/Modules/Compiler/*-DetermineCompiler.cmake") set(nonlang CXX) - if (lang STREQUAL CXX) + if ("x${lang}" STREQUAL "xCXX") set(nonlang C) endif() |