Skip to content

Commit

Permalink
build/cmake/DefinePlatformSpecifc.cmake: Ensure ClangCl on MSVC is re…
Browse files Browse the repository at this point in the history
…cognized as MSVC (because it does not handle -Wall too well)
emmenlau committed Jan 18, 2021
1 parent d831230 commit 7f9abb1
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions build/cmake/DefinePlatformSpecifc.cmake
Original file line number Diff line number Diff line change
@@ -25,13 +25,7 @@ set(CMAKE_DEBUG_POSTFIX "d" CACHE STRING "Set debug library postfix")

# basic options
foreach(lang IN ITEMS C CXX)
if(CMAKE_${lang}_COMPILER_ID STREQUAL "Clang")
set(CMAKE_${lang}_FLAGS "${CMAKE_${lang}_FLAGS} -Wall")
set(CMAKE_${lang}_FLAGS "${CMAKE_${lang}_FLAGS} -ferror-limit=1")
elseif(CMAKE_${lang}_COMPILER_ID STREQUAL "GNU")
set(CMAKE_${lang}_FLAGS "${CMAKE_${lang}_FLAGS} -Wall -Wextra")
set(CMAKE_${lang}_FLAGS "${CMAKE_${lang}_FLAGS} -fmax-errors=1")
elseif(CMAKE_${lang}_COMPILER_ID STREQUAL "MSVC")
if("CMAKE_${lang}_COMPILER_ID" STREQUAL "MSVC" OR "${CMAKE_${lang}_SIMULATE_ID}" STREQUAL "MSVC")
set(CMAKE_${lang}_FLAGS "${CMAKE_${lang}_FLAGS} /MP") # parallel build
set(CMAKE_${lang}_FLAGS "${CMAKE_${lang}_FLAGS} /W3") # warning level 3
include(CheckCXXCompilerFlag)
@@ -45,6 +39,12 @@ foreach(lang IN ITEMS C CXX)
set(CMAKE_${lang}_FLAGS "${CMAKE_${lang}_FLAGS} /execution-charset:utf-8")
endif()
add_definitions("-DUNICODE -D_UNICODE")
elseif("CMAKE_${lang}_COMPILER_ID" STREQUAL "Clang")
set(CMAKE_${lang}_FLAGS "${CMAKE_${lang}_FLAGS} -Wall")
set(CMAKE_${lang}_FLAGS "${CMAKE_${lang}_FLAGS} -ferror-limit=1")
elseif("CMAKE_${lang}_COMPILER_ID" STREQUAL "GNU")
set(CMAKE_${lang}_FLAGS "${CMAKE_${lang}_FLAGS} -Wall -Wextra")
set(CMAKE_${lang}_FLAGS "${CMAKE_${lang}_FLAGS} -fmax-errors=1")
endif()
endforeach()

0 comments on commit 7f9abb1

Please sign in to comment.