diff options
author | Joerg Bornemann <joerg.bornemann@qt.io> | 2022-11-16 12:08:31 (GMT) |
---|---|---|
committer | Joerg Bornemann <joerg.bornemann@qt.io> | 2022-11-16 12:08:31 (GMT) |
commit | d538cb0e1890f15e2ea4b3433f4cc0d46f57e62f (patch) | |
tree | bad36e01c34153610812a00f92678417bc1061d2 /Modules/Compiler/GNU.cmake | |
parent | b7ab39bf59c1b68140f1884676a2cfdaee2f7b41 (diff) | |
download | CMake-d538cb0e1890f15e2ea4b3433f4cc0d46f57e62f.zip CMake-d538cb0e1890f15e2ea4b3433f4cc0d46f57e62f.tar.gz CMake-d538cb0e1890f15e2ea4b3433f4cc0d46f57e62f.tar.bz2 |
Only initialize CMAKE_CXX_COMPILER_PREDEFINES_COMMAND
Don't initialize the other CMAKE_<LANG>_COMPILER_PREDEFINES_COMMAND
variables.
The only language variant that is used is
CMAKE_CXX_COMPILER_PREDEFINES_COMMAND, and the other language variants
contained invalid, namely C++-specific commands.
Fixes: #23968
Diffstat (limited to 'Modules/Compiler/GNU.cmake')
-rw-r--r-- | Modules/Compiler/GNU.cmake | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/Modules/Compiler/GNU.cmake b/Modules/Compiler/GNU.cmake index 48639cd..5930e37 100644 --- a/Modules/Compiler/GNU.cmake +++ b/Modules/Compiler/GNU.cmake @@ -121,13 +121,15 @@ macro(__compiler_gnu lang) ) endif() - set(CMAKE_${lang}_COMPILER_PREDEFINES_COMMAND "${CMAKE_${lang}_COMPILER}") - if(CMAKE_${lang}_COMPILER_ARG1) - separate_arguments(_COMPILER_ARGS NATIVE_COMMAND "${CMAKE_${lang}_COMPILER_ARG1}") - list(APPEND CMAKE_${lang}_COMPILER_PREDEFINES_COMMAND ${_COMPILER_ARGS}) - unset(_COMPILER_ARGS) + if("${lang}" STREQUAL "CXX") + set(CMAKE_${lang}_COMPILER_PREDEFINES_COMMAND "${CMAKE_${lang}_COMPILER}") + if(CMAKE_${lang}_COMPILER_ARG1) + separate_arguments(_COMPILER_ARGS NATIVE_COMMAND "${CMAKE_${lang}_COMPILER_ARG1}") + list(APPEND CMAKE_${lang}_COMPILER_PREDEFINES_COMMAND ${_COMPILER_ARGS}) + unset(_COMPILER_ARGS) + endif() + list(APPEND CMAKE_${lang}_COMPILER_PREDEFINES_COMMAND "-dM" "-E" "-c" "${CMAKE_ROOT}/Modules/CMakeCXXCompilerABI.cpp") endif() - list(APPEND CMAKE_${lang}_COMPILER_PREDEFINES_COMMAND "-dM" "-E" "-c" "${CMAKE_ROOT}/Modules/CMakeCXXCompilerABI.cpp") if(NOT "x${lang}" STREQUAL "xFortran") set(CMAKE_PCH_EXTENSION .gch) |