CMakeLists.txt: also match 'AppleClang' compiler to not link with libc++

This commit is contained in:
Cosimo Lupo 2022-04-06 12:54:40 +01:00 committed by Khaled Hosny
parent 88bb746b42
commit 53eeeab0e3
1 changed files with 3 additions and 1 deletions

View File

@ -462,7 +462,9 @@ if (UNIX OR MINGW)
link_libraries(-Bsymbolic-functions)
endif ()
if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang" OR CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
# As of CMake 3.0.0, the compiler id for Apple-provided Clang is now "AppleClang";
# thus we use MATCHES instead of STREQUAL to include either regular Clang or AppleClang
if (CMAKE_CXX_COMPILER_ID MATCHES "Clang" OR CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
# Make sure we don't link to libstdc++
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-rtti -fno-exceptions")
set (CMAKE_CXX_IMPLICIT_LINK_LIBRARIES "m") # libm