Cleanup main CMakeLists.txt to better match CMake conventions
This commit is contained in:
parent
0041d68807
commit
13a394e07f
52
deps/ox/CMakeLists.txt
vendored
52
deps/ox/CMakeLists.txt
vendored
@ -11,50 +11,40 @@ set(OX_USE_STDLIB "ON" CACHE STRING "Build libraries that need the std lib (ON/O
|
|||||||
|
|
||||||
# can't run tests without building them
|
# can't run tests without building them
|
||||||
if(OX_BUILD_EXEC STREQUAL "OFF" OR OX_USE_STDLIB STREQUAL "OFF")
|
if(OX_BUILD_EXEC STREQUAL "OFF" OR OX_USE_STDLIB STREQUAL "OFF")
|
||||||
set(OX_BUILD_EXEC "OFF")
|
set(OX_BUILD_EXEC OFF)
|
||||||
set(OX_RUN_TESTS "OFF")
|
set(OX_RUN_TESTS OFF)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
set(CMAKE_CXX_STANDARD 17)
|
set(CMAKE_CXX_STANDARD 17)
|
||||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||||
set(CMAKE_CXX_EXTENSIONS OFF)
|
set(CMAKE_CXX_EXTENSIONS OFF)
|
||||||
|
|
||||||
|
if (CMAKE_BUILD_TYPE STREQUAL "Release")
|
||||||
|
add_definitions(-DNDEBUG)
|
||||||
|
else()
|
||||||
|
add_definitions(-DDEBUG)
|
||||||
|
endif()
|
||||||
|
|
||||||
if(OX_USE_STDLIB STREQUAL "ON")
|
if(OX_USE_STDLIB STREQUAL "ON")
|
||||||
add_definitions(-DOX_USE_STDLIB)
|
add_definitions(-DOX_USE_STDLIB)
|
||||||
|
else()
|
||||||
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -nostdlib")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(NOT MSVC)
|
if(NOT MSVC)
|
||||||
add_definitions(
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall")
|
||||||
-std=c++17
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wextra")
|
||||||
-nostdlib
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wsign-compare")
|
||||||
-fno-exceptions
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wunused-variable")
|
||||||
-fno-rtti
|
|
||||||
-Wall
|
|
||||||
-Wextra
|
|
||||||
-Wsign-compare
|
|
||||||
-Wunused-variable
|
|
||||||
)
|
|
||||||
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()
|
|
||||||
|
|
||||||
if (CMAKE_BUILD_TYPE STREQUAL "Release")
|
if (CMAKE_BUILD_TYPE STREQUAL "Release")
|
||||||
add_definitions(
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror")
|
||||||
-DNDEBUG
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3")
|
||||||
)
|
endif()
|
||||||
else()
|
if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
|
||||||
add_definitions(
|
# forces colored output when using ninja
|
||||||
-DDEBUG
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fdiagnostics-color")
|
||||||
)
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
enable_testing()
|
enable_testing()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user