@@ -57,6 +57,10 @@ include(SetVersion.cmake)
5757# call the wrapper
5858list (INSERT CMAKE_MODULE_PATH 0 "${CMAKE_CURRENT_LIST_DIR} /cmake" )
5959
60+ set (CMAKE_CXX_STANDARD 11)
61+ set (CMAKE_CXX_EXTENSIONS NO )
62+ set (CMAKE_CXX_STANDARD_REQUIRED YES )
63+
6064if (WIN32 )
6165 # By default cmake adds a warning level.
6266 # Nevertheless a different level is wanted for this project.
@@ -76,15 +80,13 @@ if(WIN32)
7680 # and thus are not to be used by the client. A better fix would be to export
7781 # only public methods instead of the whole class, but they are too many to
7882 # do that. A separated plugin interface would fix that.
79- set ( CMAKE_CXX_FLAGS " ${CMAKE_CXX_FLAGS} /W4 /FIiso646.h -wd4127 -wd4251" )
83+ set_property ( DIRECTORY PROPERTY COMPILE_OPTIONS /W4 /FIiso646.h -wd4127 -wd4251)
8084
8185 # FIXME: Once we have removed all warnings on windows, add the /WX flags if
8286 # FATAL_WARNINGS is enabled
8387else ()
84- set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall -Wextra -Wconversion -Wno-sign-conversion" )
85- if (FATAL_WARNINGS)
86- set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror" )
87- endif ()
88+ set_property (DIRECTORY PROPERTY COMPILE_OPTIONS -Wall -Wextra -Wconversion -Wno-sign-conversion
89+ $<$<BOOL :FATAL_WARNINGS>:-Werror>)
8890endif ()
8991
9092# Hide symbols by default, then exposed symbols are the same in linux and windows
@@ -101,6 +103,8 @@ set(CMAKE_INCLUDE_CURRENT_DIR_IN_INTERFACE ON)
101103
102104include (ctest/CMakeLists.txt)
103105
106+ # Since there is no directory-wide property for linker flags, we can't use
107+ # set_property for the link-time coverage flags.
104108if (COVERAGE)
105109 set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fprofile-arcs -ftest-coverage" )
106110 set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fprofile-arcs -ftest-coverage" )
0 commit comments