From 56ed98268fd2361c54a07188237ffbc2eadfaa28 Mon Sep 17 00:00:00 2001 From: Gary Talent Date: Fri, 9 Mar 2018 21:46:47 -0600 Subject: [PATCH] Add some missing compiler checks to the main CMakeLists.txt --- CMakeLists.txt | 52 +++++++++++++++++++++++++++++--------------------- 1 file changed, 30 insertions(+), 22 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d80aa50e..6bd76a61 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -17,34 +17,48 @@ if(CMAKE_BUILD_TYPE STREQUAL "Debug") ) else() add_definitions( - -Werror -DNDEBUG + -Werror ) endif() -if(NOSTALGIA_BUILD_TYPE STREQUAL "GBA") - include(GBA) +if(NOT MSVC) add_definitions( - -nostdlib - -fno-exceptions - -fno-rtti - -fno-strict-aliasing - -mthumb-interwork - -mthumb + -Wall + -Wsign-compare ) + + + if(NOSTALGIA_BUILD_TYPE STREQUAL "GBA") + include(GBA) + add_definitions( + -nostdlib + -fno-exceptions + -fno-rtti + -fno-strict-aliasing + -mthumb-interwork + -mthumb + ) + endif() + + if (CMAKE_BUILD_TYPE STREQUAL "Release") + add_definitions( + -Werror + -O3 + ) + endif() + + if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang") + add_definitions( + -fdiagnostics-color # forces colored output when using ninja + ) + endif() endif() set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_EXTENSIONS OFF) -add_definitions( - #-fdiagnostics-color # forces colored output when using ninja - -Wall - -Wsign-compare -) - - if(NOSTALGIA_IDE_BUILD STREQUAL "ON") set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}) set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}) @@ -70,12 +84,6 @@ else() set(NOSTALGIA_DIST_RESOURCES share) endif() -if(CMAKE_BUILD_TYPE STREQUAL "Release") - add_definitions( - -Werror - ) -endif() - enable_testing() add_subdirectory(deps/ox)