CMakeLists: add -Werror for linux/mac, ignore warnings on microprofile and nihstro and inhibit a faulty warning

Inhibit clang's -Wtautological-constant-out-of-range-compare warning as
static_casts may yield invalid values for enums that are still in the range of
the underlying type, thus making the check not so tautological. It's a clang
bug, see https://llvm.org/bugs/show_bug.cgi?id=16154
This commit is contained in:
Paul Dettorer Hervot 2015-12-16 11:54:53 +01:00 committed by Paul "Dettorer" Hervot
parent c8d37ee27a
commit ee49f6bd9d

View File

@ -64,8 +64,15 @@ if (NOT DEFINED ARCHITECTURE)
endif() endif()
message(STATUS "Target architecture: ${ARCHITECTURE}") message(STATUS "Target architecture: ${ARCHITECTURE}")
if (NOT CMAKE_GENERATOR STREQUAL Xcode)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror")
endif()
if (NOT MSVC) if (NOT MSVC)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++1y -Wno-attributes -pthread") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++1y -Wno-attributes -pthread")
# Currently, clang incorrectly throws this warning with enums, see https://llvm.org/bugs/show_bug.cgi?id=16154
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-tautological-constant-out-of-range-compare")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -pthread") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -pthread")
if (ARCHITECTURE_x86_64) if (ARCHITECTURE_x86_64)
@ -233,8 +240,8 @@ include_directories(${INI_PREFIX})
add_subdirectory(${INI_PREFIX}) add_subdirectory(${INI_PREFIX})
add_subdirectory(externals/glad) add_subdirectory(externals/glad)
include_directories(externals/microprofile) include_directories(SYSTEM externals/microprofile) # TODO: remove "SYSTEM" and actually fix the warnings upstream
include_directories(externals/nihstro/include) include_directories(SYSTEM externals/nihstro/include) # TODO: remove "SYSTEM" and actually fix the warnings upstream
if (MSVC) if (MSVC)
add_subdirectory(externals/getopt) add_subdirectory(externals/getopt)