Add targets for warnings, flags and noexcept flags

This commit is contained in:
Denis Blank 2017-10-04 22:23:25 +02:00
parent 257c1b0062
commit 76f3fb0380
5 changed files with 41 additions and 8 deletions

View File

@ -1 +1,5 @@
add_library(continuable-features-flags INTERFACE)
add_library(continuable-features-warnings INTERFACE)
add_library(continuable-features-noexcept INTERFACE)
include(cmake/configure_compiler.cmake)

View File

@ -1,8 +1,15 @@
# Enable full warnings
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -pedantic -Wextra")
target_compile_options(continuable-features-warnings
INTERFACE
-Wall
-pedantic
-Wextra)
if (TESTS_NO_EXCEPTIONS)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-exceptions")
target_compile_options(continuable-features-noexcept
INTERFACE
-fno-exceptions)
message(STATUS "Clang: Disabled exceptions")
endif()

View File

@ -1,7 +1,14 @@
# Enable full warnings
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -pedantic -Wextra")
target_compile_options(continuable-features-warnings
INTERFACE
-Wall
-pedantic
-Wextra)
if (TESTS_NO_EXCEPTIONS)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-exceptions")
target_compile_options(continuable-features-noexcept
INTERFACE
-fno-exceptions)
message(STATUS "GCC: Disabled exceptions")
endif()

View File

@ -5,13 +5,25 @@ else()
endif()
if (PLATFORM EQUAL 64)
add_definitions("-D_WIN64")
target_compile_definitions(continuable-features-flags
INTERFACE
-D_WIN64)
endif()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W4 /MP2 /bigobj")
target_compile_options(continuable-features-flags
INTERFACE
/MP2
/bigobj)
target_compile_options(continuable-features-warnings
INTERFACE
/W4)
if (TESTS_NO_EXCEPTIONS)
add_definitions(-D_HAS_EXCEPTIONS=0)
target_compile_definitions(continuable-features-noexcept
INTERFACE
-D_HAS_EXCEPTIONS=0)
string(REGEX REPLACE "/GX" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
string(REGEX REPLACE "/EHsc" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
message(STATUS "MSVC: Disabled exceptions")

View File

@ -24,7 +24,10 @@ foreach(STEP RANGE 4)
PRIVATE
gtest-main
cxx_function
continuable)
continuable
continuable-features-flags
continuable-features-warnings
continuable-features-noexcept)
target_compile_definitions(${PROJECT_NAME}
PUBLIC