Upgrade to CMake 3.22

This commit is contained in:
Chris Thrasher 2023-05-08 17:17:20 -06:00
parent 27249d42ed
commit 98a59d62c7
2 changed files with 4 additions and 11 deletions

View File

@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.16) cmake_minimum_required(VERSION 3.22)
# define a macro that helps defining an option # define a macro that helps defining an option
macro(sfml_set_option var default type docstring) 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) include(CPack)
# configure extras by default when building SFML directly, otherwise hide them # configure extras by default when building SFML directly, otherwise hide them
if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME) sfml_set_option(SFML_CONFIGURE_EXTRAS ${PROJECT_IS_TOP_LEVEL} BOOL "TRUE to configure extras, FALSE to ignore them")
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")
if(NOT SFML_CONFIGURE_EXTRAS) if(NOT SFML_CONFIGURE_EXTRAS)
return() return()

View File

@ -1,10 +1,8 @@
cmake_minimum_required(VERSION 3.16) cmake_minimum_required(VERSION 3.22)
project(test-sfml-install CXX) project(test-sfml-install CXX)
# This skips the find_package call when building via add_subdirectory since that will fail under those circumstances # 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 if(PROJECT_IS_TOP_LEVEL)
# https://cmake.org/cmake/help/latest/variable/PROJECT_IS_TOP_LEVEL.html
if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME)
if(NOT BUILD_SHARED_LIBS) if(NOT BUILD_SHARED_LIBS)
set(SFML_STATIC_LIBRARIES TRUE) set(SFML_STATIC_LIBRARIES TRUE)
endif() endif()