CMake: Fix detecting AppleClang

Policies are now correctly initialized (before creating the project).
Policy CMP0025 changes the compilerID of Clang on Apple, handle this correctly.
This commit is contained in:
Maarten Bent
2019-07-19 01:51:47 +02:00
parent 46f01bfe8b
commit 7f5ca2a4cb
2 changed files with 3 additions and 3 deletions

View File

@@ -62,7 +62,7 @@ if(MSVC)
string(REGEX REPLACE "/W[0-4]" "" CMAKE_C_FLAGS "${CMAKE_C_FLAGS}") string(REGEX REPLACE "/W[0-4]" "" CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")
string(REGEX REPLACE "/W[0-4]" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") string(REGEX REPLACE "/W[0-4]" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
endif() endif()
elseif(("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") OR ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")) elseif(("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") OR ("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang"))
if(wxBUILD_OPTIMISE) if(wxBUILD_OPTIMISE)
set(GCC_PREFERRED_RELEASE_FLAGS " -O2 -fomit-frame-pointer") set(GCC_PREFERRED_RELEASE_FLAGS " -O2 -fomit-frame-pointer")
wx_string_append(CMAKE_CXX_FLAGS_RELEASE "${GCC_PREFERRED_RELEASE_FLAGS}") wx_string_append(CMAKE_CXX_FLAGS_RELEASE "${GCC_PREFERRED_RELEASE_FLAGS}")
@@ -100,7 +100,7 @@ endif()
if(wxUSE_NO_RTTI) if(wxUSE_NO_RTTI)
if(MSVC) if(MSVC)
add_compile_options("/GR-") add_compile_options("/GR-")
elseif(("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") OR ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")) elseif(("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") OR ("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang"))
wx_string_append(CMAKE_CXX_FLAGS " -fno-rtti") wx_string_append(CMAKE_CXX_FLAGS " -fno-rtti")
endif() endif()
add_definitions("-DwxNO_RTTI") add_definitions("-DwxNO_RTTI")

View File

@@ -176,7 +176,7 @@ if(wxBUILD_PRECOMP)
# standard c++ headers when using clang. # standard c++ headers when using clang.
# Do not disable precompiled headers entirely but use the main Scintilla # Do not disable precompiled headers entirely but use the main Scintilla
# header as prefix header so there is at least a small speedup. # header as prefix header so there is at least a small speedup.
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") if ("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
set(wxSCINTILLA_PREC_HEADER "${wxSOURCE_DIR}/src/stc/scintilla/include/Scintilla.h") set(wxSCINTILLA_PREC_HEADER "${wxSOURCE_DIR}/src/stc/scintilla/include/Scintilla.h")
endif() endif()
wx_target_enable_precomp(wxscintilla ${wxSCINTILLA_PREC_HEADER}) wx_target_enable_precomp(wxscintilla ${wxSCINTILLA_PREC_HEADER})