Support clang-cl on Windows
clang-cl is an MSVC-like driver for clang on Windows. It needs MSVC style options and CMake sets MSVC when it is being used.
This commit is contained in:
@@ -38,7 +38,7 @@ if(NOT CMAKE_CXX_STANDARD)
|
|||||||
endif(NOT CMAKE_CXX_STANDARD)
|
endif(NOT CMAKE_CXX_STANDARD)
|
||||||
|
|
||||||
# https://github.com/izenecloud/cmake/blob/master/SetCompilerWarningAll.cmake
|
# https://github.com/izenecloud/cmake/blob/master/SetCompilerWarningAll.cmake
|
||||||
if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
|
if(MSVC)
|
||||||
# Use the highest warning level for Visual Studio.
|
# Use the highest warning level for Visual Studio.
|
||||||
set(CMAKE_CXX_WARNING_LEVEL 4)
|
set(CMAKE_CXX_WARNING_LEVEL 4)
|
||||||
if(CMAKE_CXX_FLAGS MATCHES "/W[0-4]")
|
if(CMAKE_CXX_FLAGS MATCHES "/W[0-4]")
|
||||||
@@ -55,7 +55,7 @@ if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
|
|||||||
# Disable RTTI.
|
# Disable RTTI.
|
||||||
string(REGEX REPLACE "/GR" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
|
string(REGEX REPLACE "/GR" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /GR-")
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /GR-")
|
||||||
else(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
|
else(MSVC)
|
||||||
# Use -Wall for clang and gcc.
|
# Use -Wall for clang and gcc.
|
||||||
if(NOT CMAKE_CXX_FLAGS MATCHES "-Wall")
|
if(NOT CMAKE_CXX_FLAGS MATCHES "-Wall")
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall")
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall")
|
||||||
@@ -85,7 +85,7 @@ else(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
|
|||||||
# Disable RTTI.
|
# Disable RTTI.
|
||||||
string(REGEX REPLACE "-frtti" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
|
string(REGEX REPLACE "-frtti" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-rtti")
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-rtti")
|
||||||
endif(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
|
endif(MSVC)
|
||||||
|
|
||||||
# BUILD_SHARED_LIBS is a standard CMake variable, but we declare it here to make
|
# BUILD_SHARED_LIBS is a standard CMake variable, but we declare it here to make
|
||||||
# it prominent in the GUI.
|
# it prominent in the GUI.
|
||||||
|
|||||||
Reference in New Issue
Block a user