From 97537d36b3ecad9e01087655c2448a629c1beb38 Mon Sep 17 00:00:00 2001 From: Chris Thrasher Date: Sun, 17 Jul 2022 21:38:57 -0600 Subject: [PATCH] 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. --- CMakeLists.txt | 6 +----- cmake/Macros.cmake | 25 +++++-------------------- src/SFML/Window/CMakeLists.txt | 2 +- 3 files changed, 7 insertions(+), 26 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 409823b64..62a0955b4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -395,11 +395,7 @@ else() # NOTE: it's not required to link against SFML.framework set_target_properties(SFML PROPERTIES INSTALL_NAME_DIR "@rpath") if(NOT CMAKE_SKIP_BUILD_RPATH) - if (CMAKE_VERSION VERSION_LESS 3.9) - set_target_properties(${target} PROPERTIES BUILD_WITH_INSTALL_RPATH TRUE) - else() - set_target_properties(${target} PROPERTIES BUILD_WITH_INSTALL_NAME_DIR TRUE) - endif() + set_target_properties(${target} PROPERTIES BUILD_WITH_INSTALL_NAME_DIR TRUE) endif() # install rule diff --git a/cmake/Macros.cmake b/cmake/Macros.cmake index b5ed31298..0c2caacb1 100644 --- a/cmake/Macros.cmake +++ b/cmake/Macros.cmake @@ -76,12 +76,7 @@ macro(sfml_add_library module) # Add required flags for GCC if coverage reporting is enabled if (SFML_ENABLE_COVERAGE AND (SFML_COMPILER_GCC OR SFML_COMPILER_CLANG)) target_compile_options(${target} PUBLIC $<$:-O0> $<$:-g> $<$:-fprofile-arcs> $<$:-ftest-coverage>) - - if (CMAKE_VERSION VERSION_GREATER_EQUAL 3.13) - target_link_options(${target} PUBLIC $<$:--coverage>) - else() - target_link_libraries(${target} PUBLIC $<$:--coverage>) - endif() + target_link_options(${target} PUBLIC $<$:--coverage>) endif() 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) set_target_properties(${target} PROPERTIES INSTALL_NAME_DIR "@rpath") if(NOT CMAKE_SKIP_BUILD_RPATH) - if (CMAKE_VERSION VERSION_LESS 3.9) - set_target_properties(${target} PROPERTIES BUILD_WITH_INSTALL_RPATH TRUE) - else() - set_target_properties(${target} PROPERTIES BUILD_WITH_INSTALL_NAME_DIR TRUE) - endif() + set_target_properties(${target} PROPERTIES BUILD_WITH_INSTALL_NAME_DIR TRUE) 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 # 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 (CMAKE_VERSION VERSION_GREATER_EQUAL 3.13) - foreach (DEPENDENCY ${DEPENDS}) - target_link_options(${target} PRIVATE $<$:/WHOLEARCHIVE:$>) - endforeach() - else() - foreach (DEPENDENCY ${DEPENDS}) - target_link_libraries(${target} PRIVATE $<$:/WHOLEARCHIVE:$>) - endforeach() - endif() + foreach (DEPENDENCY ${DEPENDS}) + target_link_options(${target} PRIVATE $<$:/WHOLEARCHIVE:$>) + endforeach() endif() # Add the test diff --git a/src/SFML/Window/CMakeLists.txt b/src/SFML/Window/CMakeLists.txt index 5d5f831e1..d2afd093a 100644 --- a/src/SFML/Window/CMakeLists.txt +++ b/src/SFML/Window/CMakeLists.txt @@ -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 # (unless the OpenGL_GL_PREFERENCE was explicitly set) # 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") endif()