diff options
author | Gregor Jasny <gjasny@googlemail.com> | 2023-06-04 18:20:10 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2023-06-05 21:31:35 (GMT) |
commit | 8c789bee83daf70239e7238f3184eb5510dc847e (patch) | |
tree | 526f5e1046ec510545da4783909ad21ef5483a5f | |
parent | 326bd503edc66142d88f1f67847a20fd6752d209 (diff) | |
download | CMake-8c789bee83daf70239e7238f3184eb5510dc847e.zip CMake-8c789bee83daf70239e7238f3184eb5510dc847e.tar.gz CMake-8c789bee83daf70239e7238f3184eb5510dc847e.tar.bz2 |
AppleClang: Fix ASM compiler identification
Recent AppleClang compilers identify themselves as
`Apple clang version 14.0.3 (clang-1403.0.22.14.1)`.
-rw-r--r-- | Modules/CMakeDetermineASMCompiler.cmake | 8 | ||||
-rw-r--r-- | Modules/Platform/Apple-AppleClang-ASM.cmake | 1 | ||||
-rw-r--r-- | Tests/Assembler/CMakeLists.txt | 2 |
3 files changed, 6 insertions, 5 deletions
diff --git a/Modules/CMakeDetermineASMCompiler.cmake b/Modules/CMakeDetermineASMCompiler.cmake index 5ec2972..8ec6c66 100644 --- a/Modules/CMakeDetermineASMCompiler.cmake +++ b/Modules/CMakeDetermineASMCompiler.cmake @@ -58,14 +58,14 @@ if(NOT CMAKE_ASM${ASM_DIALECT}_COMPILER_ID) set(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_FLAGS_GNU "--version") set(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_REGEX_GNU "(GNU assembler)|(GCC)|(Free Software Foundation)") + list(APPEND CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDORS AppleClang ) + set(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_FLAGS_AppleClang "--version") + set(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_REGEX_AppleClang "(Apple (clang|LLVM) version)") + list(APPEND CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDORS Clang ) set(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_FLAGS_Clang "--version") set(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_REGEX_Clang "(clang version)") - list(APPEND CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDORS AppleClang ) - set(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_FLAGS_AppleClang "--version") - set(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_REGEX_AppleClang "(Apple LLVM version)") - list(APPEND CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDORS ARMClang ) set(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_FLAGS_ARMClang "--version") set(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_REGEX_ARMClang "armclang") diff --git a/Modules/Platform/Apple-AppleClang-ASM.cmake b/Modules/Platform/Apple-AppleClang-ASM.cmake new file mode 100644 index 0000000..c8ff470 --- /dev/null +++ b/Modules/Platform/Apple-AppleClang-ASM.cmake @@ -0,0 +1 @@ +include(Platform/Apple-Clang-ASM) diff --git a/Tests/Assembler/CMakeLists.txt b/Tests/Assembler/CMakeLists.txt index 8f6b355..4635f03 100644 --- a/Tests/Assembler/CMakeLists.txt +++ b/Tests/Assembler/CMakeLists.txt @@ -24,7 +24,7 @@ if("${CMAKE_GENERATOR}" MATCHES "Makefile|Xcode|Ninja" AND elseif("${CMAKE_SYSTEM_NAME};${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "Darwin;arm64") list(APPEND C_FLAGS -arch arm64) endif() - if(CMAKE_C_COMPILER_ID STREQUAL "Clang") + if(CMAKE_C_COMPILER_ID MATCHES "Clang") # Just in case the user is passing -flto, we need to pass -fno-lto to # clang when generating the assembly file, or else clang will generate # LLVM IR instead of assembly. |