Remove unnecessary CMake version checks

Now that the project requires CMake version 3.15, all of these
checks are guaranteed to eveluate one way or the other so they can
be removed.
This commit is contained in:
Chris Thrasher 2022-07-17 21:38:57 -06:00 committed by Lukas Dürrenberger
parent 55a1a2a4c4
commit 97537d36b3
3 changed files with 7 additions and 26 deletions

View File

@ -395,11 +395,7 @@ else()
# NOTE: it's not required to link against SFML.framework # NOTE: it's not required to link against SFML.framework
set_target_properties(SFML PROPERTIES INSTALL_NAME_DIR "@rpath") set_target_properties(SFML PROPERTIES INSTALL_NAME_DIR "@rpath")
if(NOT CMAKE_SKIP_BUILD_RPATH) if(NOT CMAKE_SKIP_BUILD_RPATH)
if (CMAKE_VERSION VERSION_LESS 3.9) set_target_properties(${target} PROPERTIES BUILD_WITH_INSTALL_NAME_DIR TRUE)
set_target_properties(${target} PROPERTIES BUILD_WITH_INSTALL_RPATH TRUE)
else()
set_target_properties(${target} PROPERTIES BUILD_WITH_INSTALL_NAME_DIR TRUE)
endif()
endif() endif()
# install rule # install rule

View File

@ -76,12 +76,7 @@ macro(sfml_add_library module)
# Add required flags for GCC if coverage reporting is enabled # Add required flags for GCC if coverage reporting is enabled
if (SFML_ENABLE_COVERAGE AND (SFML_COMPILER_GCC OR SFML_COMPILER_CLANG)) if (SFML_ENABLE_COVERAGE AND (SFML_COMPILER_GCC OR SFML_COMPILER_CLANG))
target_compile_options(${target} PUBLIC $<$<CONFIG:DEBUG>:-O0> $<$<CONFIG:DEBUG>:-g> $<$<CONFIG:DEBUG>:-fprofile-arcs> $<$<CONFIG:DEBUG>:-ftest-coverage>) target_compile_options(${target} PUBLIC $<$<CONFIG:DEBUG>:-O0> $<$<CONFIG:DEBUG>:-g> $<$<CONFIG:DEBUG>:-fprofile-arcs> $<$<CONFIG:DEBUG>:-ftest-coverage>)
target_link_options(${target} PUBLIC $<$<CONFIG:DEBUG>:--coverage>)
if (CMAKE_VERSION VERSION_GREATER_EQUAL 3.13)
target_link_options(${target} PUBLIC $<$<CONFIG:DEBUG>:--coverage>)
else()
target_link_libraries(${target} PUBLIC $<$<CONFIG:DEBUG>:--coverage>)
endif()
endif() endif()
set_target_warnings(${target}) set_target_warnings(${target})
@ -193,11 +188,7 @@ macro(sfml_add_library module)
if(NOT CMAKE_SKIP_RPATH AND NOT CMAKE_SKIP_INSTALL_RPATH AND NOT CMAKE_INSTALL_RPATH AND NOT CMAKE_INSTALL_RPATH_USE_LINK_PATH AND NOT CMAKE_INSTALL_NAME_DIR) if(NOT CMAKE_SKIP_RPATH AND NOT CMAKE_SKIP_INSTALL_RPATH AND NOT CMAKE_INSTALL_RPATH AND NOT CMAKE_INSTALL_RPATH_USE_LINK_PATH AND NOT CMAKE_INSTALL_NAME_DIR)
set_target_properties(${target} PROPERTIES INSTALL_NAME_DIR "@rpath") set_target_properties(${target} PROPERTIES INSTALL_NAME_DIR "@rpath")
if(NOT CMAKE_SKIP_BUILD_RPATH) if(NOT CMAKE_SKIP_BUILD_RPATH)
if (CMAKE_VERSION VERSION_LESS 3.9) set_target_properties(${target} PROPERTIES BUILD_WITH_INSTALL_NAME_DIR TRUE)
set_target_properties(${target} PROPERTIES BUILD_WITH_INSTALL_RPATH TRUE)
else()
set_target_properties(${target} PROPERTIES BUILD_WITH_INSTALL_NAME_DIR TRUE)
endif()
endif() endif()
endif() endif()
endif() endif()
@ -333,15 +324,9 @@ function(sfml_add_test target SOURCES DEPENDS)
# If coverage is enabled for MSVC and we are linking statically, use /WHOLEARCHIVE # If coverage is enabled for MSVC and we are linking statically, use /WHOLEARCHIVE
# to make sure the linker doesn't discard unused code sections before coverage can be measured # to make sure the linker doesn't discard unused code sections before coverage can be measured
if (SFML_ENABLE_COVERAGE AND SFML_COMPILER_MSVC AND NOT BUILD_SHARED_LIBS) if (SFML_ENABLE_COVERAGE AND SFML_COMPILER_MSVC AND NOT BUILD_SHARED_LIBS)
if (CMAKE_VERSION VERSION_GREATER_EQUAL 3.13) foreach (DEPENDENCY ${DEPENDS})
foreach (DEPENDENCY ${DEPENDS}) target_link_options(${target} PRIVATE $<$<CONFIG:DEBUG>:/WHOLEARCHIVE:$<TARGET_LINKER_FILE:${DEPENDENCY}>>)
target_link_options(${target} PRIVATE $<$<CONFIG:DEBUG>:/WHOLEARCHIVE:$<TARGET_LINKER_FILE:${DEPENDENCY}>>) endforeach()
endforeach()
else()
foreach (DEPENDENCY ${DEPENDS})
target_link_libraries(${target} PRIVATE $<$<CONFIG:DEBUG>:/WHOLEARCHIVE:$<TARGET_LINKER_FILE:${DEPENDENCY}>>)
endforeach()
endif()
endif() endif()
# Add the test # Add the test

View File

@ -283,7 +283,7 @@ target_include_directories(sfml-window SYSTEM PRIVATE "${PROJECT_SOURCE_DIR}/ext
# CMake 3.11 and later prefer to choose GLVND, but we choose legacy OpenGL for backward compability # CMake 3.11 and later prefer to choose GLVND, but we choose legacy OpenGL for backward compability
# (unless the OpenGL_GL_PREFERENCE was explicitly set) # (unless the OpenGL_GL_PREFERENCE was explicitly set)
# See CMP0072 for more details (cmake --help-policy CMP0072) # See CMP0072 for more details (cmake --help-policy CMP0072)
if ((NOT ${CMAKE_VERSION} VERSION_LESS 3.11) AND (NOT OpenGL_GL_PREFERENCE)) if (NOT OpenGL_GL_PREFERENCE)
set(OpenGL_GL_PREFERENCE "LEGACY") set(OpenGL_GL_PREFERENCE "LEGACY")
endif() endif()