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.
This commit is contained in:
Chris Thrasher 2021-12-17 22:01:56 -07:00 committed by Vittorio Romeo
parent f5541d22e5
commit dafdacfa20

View File

@ -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()
# Add the test
add_test(${target} ${target})