Skip to content

CompilerId: Tolerate variables named for languages

Brad King requested to merge brad.king/cmake:compiler-id-lang-vars into master

If a project or user sets a variable or cache entry named C, CXX, CUDA, Fortran, CSharp, or ISPC, 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.

This extends a similar fix in !6060 (merged) in more places. In particular, ensure that we consider the proper list of compiler ids.

Ported from CMake GitHub PR 341.

Author: @pcanal
Issue: #22125 (closed)
Backport: release

Edited by Brad King

Merge request reports