From 98a59d62c7965c5d758c5ab2645e6b432db8f97d Mon Sep 17 00:00:00 2001 From: Chris Thrasher Date: Mon, 8 May 2023 17:17:20 -0600 Subject: [PATCH] Upgrade to CMake 3.22 --- CMakeLists.txt | 9 ++------- test/install/CMakeLists.txt | 6 ++---- 2 files changed, 4 insertions(+), 11 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 5fc93ba13..1e8a55fa6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.16) +cmake_minimum_required(VERSION 3.22) # define a macro that helps defining an option macro(sfml_set_option var default type docstring) @@ -491,12 +491,7 @@ set(CPACK_NSIS_INSTALLER_MUI_ICON_CODE "!define MUI_WELCOMEFINISHPAGE_BITMAP \\\ include(CPack) # configure extras by default when building SFML directly, otherwise hide them -if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME) - set(SFML_CONFIGURE_EXTRAS_DEFAULT TRUE) -else() - set(SFML_CONFIGURE_EXTRAS_DEFAULT FALSE) -endif() -sfml_set_option(SFML_CONFIGURE_EXTRAS ${SFML_CONFIGURE_EXTRAS_DEFAULT} BOOL "TRUE to configure extras, FALSE to ignore them") +sfml_set_option(SFML_CONFIGURE_EXTRAS ${PROJECT_IS_TOP_LEVEL} BOOL "TRUE to configure extras, FALSE to ignore them") if(NOT SFML_CONFIGURE_EXTRAS) return() diff --git a/test/install/CMakeLists.txt b/test/install/CMakeLists.txt index b55d657de..da6f70296 100644 --- a/test/install/CMakeLists.txt +++ b/test/install/CMakeLists.txt @@ -1,10 +1,8 @@ -cmake_minimum_required(VERSION 3.16) +cmake_minimum_required(VERSION 3.22) project(test-sfml-install CXX) # This skips the find_package call when building via add_subdirectory since that will fail under those circumstances -# It's a CMake 3.16-compatible replacement to PROJECT_IS_TOP_LEVEL -# https://cmake.org/cmake/help/latest/variable/PROJECT_IS_TOP_LEVEL.html -if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME) +if(PROJECT_IS_TOP_LEVEL) if(NOT BUILD_SHARED_LIBS) set(SFML_STATIC_LIBRARIES TRUE) endif()