diff options
author | Brad King <brad.king@kitware.com> | 2023-01-25 16:19:14 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2023-01-25 16:19:21 (GMT) |
commit | 950effe434623b50a1c85e2c53ed592210e79ceb (patch) | |
tree | f0d0e5de0bd9ad407806c1f7e903773b93ac5b86 | |
parent | d1ba79da4f9eaf27d1df67e9c72723a2f8d71fd3 (diff) | |
parent | 5b45a3d0ce5e2e73cd07cb103dedd4dd0204f6d1 (diff) | |
download | CMake-950effe434623b50a1c85e2c53ed592210e79ceb.zip CMake-950effe434623b50a1c85e2c53ed592210e79ceb.tar.gz CMake-950effe434623b50a1c85e2c53ed592210e79ceb.tar.bz2 |
Merge topic 'CheckCompilerFlag-clang'
5b45a3d0ce CheckCompilerFlag: Match the Clang "argument unused" output for all languages
Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !8117
-rw-r--r-- | Modules/CMakeCheckCompilerFlagCommonPatterns.cmake | 1 | ||||
-rw-r--r-- | Modules/Internal/CMakeTryCompilerOrLinkerFlag.cmake | 1 | ||||
-rw-r--r-- | Modules/Internal/CheckFlagCommonConfig.cmake | 10 |
3 files changed, 4 insertions, 8 deletions
diff --git a/Modules/CMakeCheckCompilerFlagCommonPatterns.cmake b/Modules/CMakeCheckCompilerFlagCommonPatterns.cmake index bda1d71..cd978d5 100644 --- a/Modules/CMakeCheckCompilerFlagCommonPatterns.cmake +++ b/Modules/CMakeCheckCompilerFlagCommonPatterns.cmake @@ -12,6 +12,7 @@ macro (CHECK_COMPILER_FLAG_COMMON_PATTERNS _VAR) FAIL_REGEX "switch .* is no longer supported" # GNU FAIL_REGEX "unknown .*option" # Clang FAIL_REGEX "optimization flag .* not supported" # Clang + FAIL_REGEX "argument unused during compilation: .*" # Clang FAIL_REGEX "unknown argument ignored" # Clang (cl) FAIL_REGEX "ignoring unknown option" # MSVC, Intel FAIL_REGEX "warning D9002" # MSVC, any lang diff --git a/Modules/Internal/CMakeTryCompilerOrLinkerFlag.cmake b/Modules/Internal/CMakeTryCompilerOrLinkerFlag.cmake index b671b4a..ff8908b 100644 --- a/Modules/Internal/CMakeTryCompilerOrLinkerFlag.cmake +++ b/Modules/Internal/CMakeTryCompilerOrLinkerFlag.cmake @@ -69,7 +69,6 @@ function(CMAKE_TRY_COMPILER_OR_LINKER_FLAG lang flag result) set (CCCF_COMMAND_PATTERN "<FLAG> -o <OUTPUT> <SOURCE>") endif() - list (APPEND CCCF_FAIL_REGEX "argument unused during compilation") # clang if (check_lang STREQUAL "C") list(APPEND CCCF_FAIL_REGEX "command line option .* is valid for .* but not for C") # GNU diff --git a/Modules/Internal/CheckFlagCommonConfig.cmake b/Modules/Internal/CheckFlagCommonConfig.cmake index f8481cd..61eada2 100644 --- a/Modules/Internal/CheckFlagCommonConfig.cmake +++ b/Modules/Internal/CheckFlagCommonConfig.cmake @@ -22,30 +22,26 @@ macro(CMAKE_CHECK_FLAG_COMMON_INIT _FUNC _LANG _SRC _PATTERNS) FAIL_REGEX "-Werror=.* argument .* is not valid for C\\+\\+") elseif("${_LANG}" STREQUAL "CUDA") set(${_SRC} "__host__ int main() { return 0; }") - set(${_PATTERNS} FAIL_REGEX "command[ -]line option .* is valid for .* but not for C\\+\\+" # Host GNU - FAIL_REGEX "argument unused during compilation: .*") # Clang + set(${_PATTERNS} FAIL_REGEX "command[ -]line option .* is valid for .* but not for C\\+\\+") # Host GNU elseif("${_LANG}" STREQUAL "Fortran") set(${_SRC} " program test\n stop\n end program") set(${_PATTERNS} FAIL_REGEX "command[ -]line option .* is valid for .* but not for Fortran") elseif("${_LANG}" STREQUAL "HIP") set(${_SRC} "__host__ int main() { return 0; }") - set(${_PATTERNS} FAIL_REGEX "argument unused during compilation: .*") # Clang elseif("${_LANG}" STREQUAL "OBJC") set(${_SRC} [=[ #ifndef __OBJC__ # error "Not an Objective-C compiler" #endif int main(void) { return 0; }]=]) - set(${_PATTERNS} FAIL_REGEX "command[ -]line option .* is valid for .* but not for Objective-C" # GNU - FAIL_REGEX "argument unused during compilation: .*") # Clang + set(${_PATTERNS} FAIL_REGEX "command[ -]line option .* is valid for .* but not for Objective-C") # GNU elseif("${_LANG}" STREQUAL "OBJCXX") set(${_SRC} [=[ #ifndef __OBJC__ # error "Not an Objective-C++ compiler" #endif int main(void) { return 0; }]=]) - set(${_PATTERNS} FAIL_REGEX "command[ -]line option .* is valid for .* but not for Objective-C\\+\\+" # GNU - FAIL_REGEX "argument unused during compilation: .*") # Clang + set(${_PATTERNS} FAIL_REGEX "command[ -]line option .* is valid for .* but not for Objective-C\\+\\+") # GNU elseif("${_LANG}" STREQUAL "ISPC") set(${_SRC} "float func(uniform int32, float a) { return a / 2.25; }") elseif("${_LANG}" STREQUAL "Swift") |