From dafdacfa2066f26c9374c11844fd3f02382560e1 Mon Sep 17 00:00:00 2001 From: Chris Thrasher Date: Fri, 17 Dec 2021 22:01:56 -0700 Subject: [PATCH] Let tests and examples inherit language requirement from upstream targets It's not necessary to re-specify cxx_std_17 since any example or test which depends on a core target (which should be all of them) will pick up this language requirement that should be a public property of those targets. If that changes, these examples and tests will possibly fail to compile and correctly catch the bug that was introduced in the core library targets. --- cmake/Macros.cmake | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/cmake/Macros.cmake b/cmake/Macros.cmake index b705ec3d8..286103ef6 100644 --- a/cmake/Macros.cmake +++ b/cmake/Macros.cmake @@ -268,9 +268,6 @@ macro(sfml_add_example target) add_executable(${target} ${target_input}) endif() - # enable C++17 support - target_compile_features(${target} PUBLIC cxx_std_17) - set_file_warnings(${target_input}) # set the debug suffix @@ -308,16 +305,11 @@ function(sfml_add_test target SOURCES DEPENDS) # create the target 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_target_properties(${target} PROPERTIES FOLDER "Tests") # link the target to its SFML dependencies - if(DEPENDS) - target_link_libraries(${target} PRIVATE ${DEPENDS}) - endif() + target_link_libraries(${target} PRIVATE ${DEPENDS}) # Add the test add_test(${target} ${target})