diff options
author | Russell Greene <russell@shotover.com> | 2022-12-20 01:12:01 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2023-01-11 19:50:40 (GMT) |
commit | e4fcdfa3010d097c81035aea9a18ed08b359bf38 (patch) | |
tree | ec0c1818f12944bc709b5405f147a2c1804b36fe | |
parent | 555a892a69a744c4f7513952a0eff191bf4619cd (diff) | |
download | CMake-e4fcdfa3010d097c81035aea9a18ed08b359bf38.zip CMake-e4fcdfa3010d097c81035aea9a18ed08b359bf38.tar.gz CMake-e4fcdfa3010d097c81035aea9a18ed08b359bf38.tar.bz2 |
Set CMAKE_<LANG>_COMPILER_FRONTEND_VARIANT on single-variant compilers
The `GNU` and `MSVC` compilers obviously use their own front-end
command-line style. Also set this for `AppleClang`.
Fixes: #24232
-rw-r--r-- | Help/release/dev/frontend-variant-always.rst | 6 | ||||
-rw-r--r-- | Help/variable/CMAKE_LANG_COMPILER_FRONTEND_VARIANT.rst | 4 | ||||
-rw-r--r-- | Modules/CMakeDetermineCompilerId.cmake | 6 |
3 files changed, 15 insertions, 1 deletions
diff --git a/Help/release/dev/frontend-variant-always.rst b/Help/release/dev/frontend-variant-always.rst new file mode 100644 index 0000000..111175c --- /dev/null +++ b/Help/release/dev/frontend-variant-always.rst @@ -0,0 +1,6 @@ +frontend-variant-always +----------------------- + +* The :variable:`CMAKE_<LANG>_COMPILER_FRONTEND_VARIANT` variable is now + set for ``GNU``, ``MSVC``, and ``AppleClang`` compilers that have only + one frontend variant. diff --git a/Help/variable/CMAKE_LANG_COMPILER_FRONTEND_VARIANT.rst b/Help/variable/CMAKE_LANG_COMPILER_FRONTEND_VARIANT.rst index 128b1fb..a414463 100644 --- a/Help/variable/CMAKE_LANG_COMPILER_FRONTEND_VARIANT.rst +++ b/Help/variable/CMAKE_LANG_COMPILER_FRONTEND_VARIANT.rst @@ -16,3 +16,7 @@ the compiler whose frontend it resembles. .. note:: In other words, this variable describes what command line options and language extensions the compiler frontend expects. + +.. versionchanged:: 3.26 + This variable is set for ``GNU``, ``MSVC``, and ``AppleClang`` + compilers that have only one frontend variant. diff --git a/Modules/CMakeDetermineCompilerId.cmake b/Modules/CMakeDetermineCompilerId.cmake index 73c775a..7f392c8 100644 --- a/Modules/CMakeDetermineCompilerId.cmake +++ b/Modules/CMakeDetermineCompilerId.cmake @@ -243,8 +243,12 @@ function(CMAKE_DETERMINE_COMPILER_ID lang flagvar src) else() set(CMAKE_${lang}_COMPILER_FRONTEND_VARIANT "GNU") endif() - elseif("x${CMAKE_${lang}_COMPILER_ID}" STREQUAL "xFujitsuClang") + elseif("x${CMAKE_${lang}_COMPILER_ID}" STREQUAL "xGNU" + OR "x${CMAKE_${lang}_COMPILER_ID}" STREQUAL "xAppleClang" + OR "x${CMAKE_${lang}_COMPILER_ID}" STREQUAL "xFujitsuClang") set(CMAKE_${lang}_COMPILER_FRONTEND_VARIANT "GNU") + elseif("x${CMAKE_${lang}_COMPILER_ID}" STREQUAL "xMSVC") + set(CMAKE_${lang}_COMPILER_FRONTEND_VARIANT "MSVC") else() set(CMAKE_${lang}_COMPILER_FRONTEND_VARIANT "") endif() |