Enable and require C++17 support for all targets

This commit is contained in:
Vittorio Romeo 2021-12-01 19:14:15 +00:00 committed by Lukas Dürrenberger
parent 1aa2b7cd0d
commit bd12438916
2 changed files with 14 additions and 2 deletions

View File

@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.7.2) cmake_minimum_required(VERSION 3.8)
# customize the compiler options CMake uses to initialize variables with # customize the compiler options CMake uses to initialize variables with
set(CMAKE_USER_MAKE_RULES_OVERRIDE "${CMAKE_CURRENT_SOURCE_DIR}/cmake/CompilerOptionsOverride.cmake") set(CMAKE_USER_MAKE_RULES_OVERRIDE "${CMAKE_CURRENT_SOURCE_DIR}/cmake/CompilerOptionsOverride.cmake")
@ -345,6 +345,9 @@ else()
# create SFML.framework # create SFML.framework
add_library(SFML ${SFML_SOURCES}) add_library(SFML ${SFML_SOURCES})
# enable C++17 support
target_compile_features(SFML PUBLIC cxx_std_17)
# set the target flags to use the appropriate C++ standard library # set the target flags to use the appropriate C++ standard library
sfml_set_stdlib(SFML) sfml_set_stdlib(SFML)

View File

@ -66,6 +66,9 @@ macro(sfml_add_library target)
add_library(${target} ${THIS_SOURCES}) add_library(${target} ${THIS_SOURCES})
endif() endif()
# enable C++17 support
target_compile_features(${target} PUBLIC cxx_std_17)
set_file_warnings(${THIS_SOURCES}) set_file_warnings(${THIS_SOURCES})
# define the export symbol of the module # define the export symbol of the module
@ -265,6 +268,9 @@ macro(sfml_add_example target)
add_executable(${target} ${target_input}) add_executable(${target} ${target_input})
endif() endif()
# enable C++17 support
target_compile_features(${target} PUBLIC cxx_std_17)
set_file_warnings(${target_input}) set_file_warnings(${target_input})
# set the debug suffix # set the debug suffix
@ -302,6 +308,9 @@ function(sfml_add_test target SOURCES DEPENDS)
# create the target # create the target
add_executable(${target} ${SOURCES}) add_executable(${target} ${SOURCES})
# enable C++17 support
target_compile_features(${target} PUBLIC cxx_std_17)
# set the target's folder (for IDEs that support it, e.g. Visual Studio) # set the target's folder (for IDEs that support it, e.g. Visual Studio)
set_target_properties(${target} PROPERTIES FOLDER "Tests") set_target_properties(${target} PROPERTIES FOLDER "Tests")