From ccef69bde4f3e307f7f518101f2122858239e0d8 Mon Sep 17 00:00:00 2001 From: Brad King Date: Wed, 23 Apr 2025 11:25:01 -0400 Subject: AUTOMOC: Avoid compiler warnings while computing predefines LLVM/Clang 20, when invoked as `clang++ -E -c ...`, now warns: warning: argument unused during compilation: '-c' Drop the unnecessary `-c` flag. Also add a `-w` flag to suppress warnings so their text is not parsed as predefines. --- Modules/Compiler/GNU.cmake | 2 +- Modules/Compiler/IBMClang.cmake | 2 +- Modules/Compiler/Intel.cmake | 2 +- Modules/Compiler/IntelLLVM.cmake | 2 +- Modules/Compiler/LCC.cmake | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Modules/Compiler/GNU.cmake b/Modules/Compiler/GNU.cmake index 83c818d..793261e 100644 --- a/Modules/Compiler/GNU.cmake +++ b/Modules/Compiler/GNU.cmake @@ -133,7 +133,7 @@ macro(__compiler_gnu lang) 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") + list(APPEND CMAKE_${lang}_COMPILER_PREDEFINES_COMMAND "-w" "-dM" "-E" "${CMAKE_ROOT}/Modules/CMakeCXXCompilerABI.cpp") endif() if(NOT "x${lang}" STREQUAL "xFortran") diff --git a/Modules/Compiler/IBMClang.cmake b/Modules/Compiler/IBMClang.cmake index a43f788..58645aa 100644 --- a/Modules/Compiler/IBMClang.cmake +++ b/Modules/Compiler/IBMClang.cmake @@ -70,7 +70,7 @@ macro(__compiler_ibmclang lang) ) if("${lang}" STREQUAL "CXX") - list(APPEND CMAKE_${lang}_COMPILER_PREDEFINES_COMMAND "-dM" "-E" "-c" "${CMAKE_ROOT}/Modules/CMakeCXXCompilerABI.cpp") + list(APPEND CMAKE_${lang}_COMPILER_PREDEFINES_COMMAND "-w" "-dM" "-E" "${CMAKE_ROOT}/Modules/CMakeCXXCompilerABI.cpp") endif() set(CMAKE_PCH_EXTENSION .pch) diff --git a/Modules/Compiler/Intel.cmake b/Modules/Compiler/Intel.cmake index 367d26e..bc6f50f 100644 --- a/Modules/Compiler/Intel.cmake +++ b/Modules/Compiler/Intel.cmake @@ -40,7 +40,7 @@ else() list(APPEND CMAKE_${lang}_COMPILER_PREDEFINES_COMMAND ${_COMPILER_ARGS}) unset(_COMPILER_ARGS) endif() - list(APPEND CMAKE_${lang}_COMPILER_PREDEFINES_COMMAND "-QdM" "-P" "-Za" "${CMAKE_ROOT}/Modules/CMakeCXXCompilerABI.cpp") + list(APPEND CMAKE_${lang}_COMPILER_PREDEFINES_COMMAND "-w" "-QdM" "-P" "-Za" "${CMAKE_ROOT}/Modules/CMakeCXXCompilerABI.cpp") endif() if("x${lang}" STREQUAL "xFortran") diff --git a/Modules/Compiler/IntelLLVM.cmake b/Modules/Compiler/IntelLLVM.cmake index b9f4ca0..d3d1bc3 100644 --- a/Modules/Compiler/IntelLLVM.cmake +++ b/Modules/Compiler/IntelLLVM.cmake @@ -100,7 +100,7 @@ else() 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") + list(APPEND CMAKE_${lang}_COMPILER_PREDEFINES_COMMAND "-w" "-dM" "-E" "${CMAKE_ROOT}/Modules/CMakeCXXCompilerABI.cpp") if(CMAKE_${lang}_COMPILER_TARGET) list(APPEND CMAKE_${lang}_COMPILER_PREDEFINES_COMMAND "--target=${CMAKE_${lang}_COMPILER_TARGET}") endif() diff --git a/Modules/Compiler/LCC.cmake b/Modules/Compiler/LCC.cmake index 2892ec6..9cf957d 100644 --- a/Modules/Compiler/LCC.cmake +++ b/Modules/Compiler/LCC.cmake @@ -83,7 +83,7 @@ macro(__compiler_lcc lang) 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") + list(APPEND CMAKE_${lang}_COMPILER_PREDEFINES_COMMAND "-w" "-dM" "-E" "${CMAKE_ROOT}/Modules/CMakeCXXCompilerABI.cpp") endif() if(NOT "x${lang}" STREQUAL "xFortran") -- cgit v0.12