build(cmake): update policies (#3775)

This commit is contained in:
ReenigneArcher 2025-04-03 19:09:40 -04:00 committed by GitHub
commit 7d75e4b75f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 15 additions and 3 deletions

View file

@ -15,14 +15,19 @@ if(BOOST_USE_STATIC)
set(Boost_USE_STATIC_LIBS ON) # cmake-lint: disable=C0103 set(Boost_USE_STATIC_LIBS ON) # cmake-lint: disable=C0103
endif() endif()
if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.30")
cmake_policy(SET CMP0167 NEW) # Get BoostConfig.cmake from upstream
endif()
find_package(Boost CONFIG ${BOOST_VERSION} COMPONENTS ${BOOST_COMPONENTS}) find_package(Boost CONFIG ${BOOST_VERSION} COMPONENTS ${BOOST_COMPONENTS})
if(NOT Boost_FOUND) if(NOT Boost_FOUND)
message(STATUS "Boost v${BOOST_VERSION}.x package not found in the system. Falling back to FetchContent.") message(STATUS "Boost v${BOOST_VERSION}.x package not found in the system. Falling back to FetchContent.")
include(FetchContent) include(FetchContent)
# Avoid warning about DOWNLOAD_EXTRACT_TIMESTAMP in CMake 3.24:
if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.24.0") if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.24.0")
cmake_policy(SET CMP0135 NEW) cmake_policy(SET CMP0135 NEW) # Avoid warning about DOWNLOAD_EXTRACT_TIMESTAMP in CMake 3.24
endif()
if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.31.0")
cmake_policy(SET CMP0174 NEW) # Handle empty variables
endif() endif()
# more components required for compiling boost targets # more components required for compiling boost targets

View file

@ -8,6 +8,13 @@ if(NOT nlohmann_json_FOUND)
message(STATUS "nlohmann_json v3.11.x package not found in the system. Falling back to FetchContent.") message(STATUS "nlohmann_json v3.11.x package not found in the system. Falling back to FetchContent.")
include(FetchContent) include(FetchContent)
if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.24.0")
cmake_policy(SET CMP0135 NEW) # Avoid warning about DOWNLOAD_EXTRACT_TIMESTAMP in CMake 3.24
endif()
if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.31.0")
cmake_policy(SET CMP0174 NEW) # Handle empty variables
endif()
FetchContent_Declare( FetchContent_Declare(
json json
URL https://github.com/nlohmann/json/releases/download/v3.11.3/json.tar.xz URL https://github.com/nlohmann/json/releases/download/v3.11.3/json.tar.xz

View file

@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.0) cmake_minimum_required(VERSION 3.20)
project(sunshine_tools) project(sunshine_tools)