Skip to content

Commit 526bc5a

Browse files
committed
cmake: fix AppleClang detection
CMake 3.0 and above recognize that Apple Clang is a different compiler than upstream Clang. CMake 4.0 prefers to set the `CMAKE_<LANG>_COMPILER_ID` variable to AppleClang instead of Clang. See [1] for details. This patch adds the corresponding check to set `CMAKE_COMPILER_IS_CLANG` for the Apple Clang too. [1]: https://cmake.org/cmake/help/v4.0/policy/CMP0025.html NO_DOC=build NO_TEST=build NO_CHANGELOG=build
1 parent 86c10c1 commit 526bc5a

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

cmake/compiler.cmake

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ endif()
1212
# We support building with Clang and gcc. First check
1313
# what we're using for build.
1414
#
15-
if (CMAKE_C_COMPILER_ID STREQUAL Clang)
15+
if (CMAKE_C_COMPILER_ID STREQUAL Clang OR
16+
CMAKE_C_COMPILER_ID STREQUAL AppleClang)
1617
set(CMAKE_COMPILER_IS_CLANG ON)
1718
set(CMAKE_COMPILER_IS_GNUCC OFF)
1819
set(CMAKE_COMPILER_IS_GNUCXX OFF)

0 commit comments

Comments
 (0)