Skip to content

Commit 201b2b8

Browse files
Merge #1675: cmake: Bump minimum required CMake version to 3.22
3af7198 cmake: Bump minimum required CMake version to 3.22 (Hennadii Stepanov) Pull request description: Ubuntu 20.04 LTS has [reached](https://wiki.ubuntu.com/Releases) the End of Standard Support. There no longer appear to be compelling reasons to maintain compatibility with CMake 3.16. The new suggested minimum, CMake 3.22, is shipped with Ubuntu 22.04 LTS, which is supported until April 2027. This PR also introduces new CMake policies, from CMP0098 to CMP0128. Some of these may warrant the reviewers' attention: - [CMP0099: Link properties are transitive over private dependencies of static libraries.](https://cmake.org/cmake/help/latest/policy/CMP0099.html) - [CMP0117: MSVC RTTI flag /GR is not added to CMAKE_CXX_FLAGS by default.](https://cmake.org/cmake/help/latest/policy/CMP0117.html) - [CMP0126: set(CACHE) does not remove a normal variable of the same name.](https://cmake.org/cmake/help/latest/policy/CMP0126.html) - [CMP0128: Selection of language standard and extension flags improved.](https://cmake.org/cmake/help/latest/policy/CMP0128.html) ACKs for top commit: real-or-random: utACK 3af7198 Tree-SHA512: f0c70dd5beafe830513895f076cafa6902dfcaab79d40bf9e7b27f14d9c4818f91d75f6aa993ba843f1d28ccd13cf466ad11dca46ca022cab1b43aace17d3ff7
2 parents 9239447 + 3af7198 commit 201b2b8

File tree

3 files changed

+7
-27
lines changed

3 files changed

+7
-27
lines changed

CMakeLists.txt

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
cmake_minimum_required(VERSION 3.16)
1+
cmake_minimum_required(VERSION 3.22)
22

33
#=============================
44
# Project / Package metadata
@@ -15,17 +15,6 @@ project(libsecp256k1
1515
enable_testing()
1616
list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake)
1717

18-
if(CMAKE_VERSION VERSION_LESS 3.21)
19-
# Emulates CMake 3.21+ behavior.
20-
if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
21-
set(PROJECT_IS_TOP_LEVEL ON)
22-
set(${PROJECT_NAME}_IS_TOP_LEVEL ON)
23-
else()
24-
set(PROJECT_IS_TOP_LEVEL OFF)
25-
set(${PROJECT_NAME}_IS_TOP_LEVEL OFF)
26-
endif()
27-
endif()
28-
2918
# The library version is based on libtool versioning of the ABI. The set of
3019
# rules for updating the version can be found here:
3120
# https://www.gnu.org/software/libtool/manual/html_node/Updating-version-info.html

CMakePresets.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
{
2-
"cmakeMinimumRequired": {"major": 3, "minor": 21, "patch": 0},
32
"version": 3,
43
"configurePresets": [
54
{

src/CMakeLists.txt

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -48,20 +48,12 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
4848
VERSION ${${PROJECT_NAME}_soversion}.${${PROJECT_NAME}_LIB_VERSION_AGE}.${${PROJECT_NAME}_LIB_VERSION_REVISION}
4949
)
5050
elseif(APPLE)
51-
if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.17)
52-
math(EXPR ${PROJECT_NAME}_compatibility_version "${${PROJECT_NAME}_LIB_VERSION_CURRENT} + 1")
53-
set_target_properties(secp256k1 PROPERTIES
54-
MACHO_COMPATIBILITY_VERSION ${${PROJECT_NAME}_compatibility_version}
55-
MACHO_CURRENT_VERSION ${${PROJECT_NAME}_compatibility_version}.${${PROJECT_NAME}_LIB_VERSION_REVISION}
56-
)
57-
unset(${PROJECT_NAME}_compatibility_version)
58-
elseif(BUILD_SHARED_LIBS)
59-
message(WARNING
60-
"The 'compatibility version' and 'current version' values of the DYLIB "
61-
"will diverge from the values set by the GNU Libtool. To ensure "
62-
"compatibility, it is recommended to upgrade CMake to at least version 3.17."
63-
)
64-
endif()
51+
math(EXPR ${PROJECT_NAME}_compatibility_version "${${PROJECT_NAME}_LIB_VERSION_CURRENT} + 1")
52+
set_target_properties(secp256k1 PROPERTIES
53+
MACHO_COMPATIBILITY_VERSION ${${PROJECT_NAME}_compatibility_version}
54+
MACHO_CURRENT_VERSION ${${PROJECT_NAME}_compatibility_version}.${${PROJECT_NAME}_LIB_VERSION_REVISION}
55+
)
56+
unset(${PROJECT_NAME}_compatibility_version)
6557
elseif(CMAKE_SYSTEM_NAME STREQUAL "Windows")
6658
set(${PROJECT_NAME}_windows "secp256k1")
6759
if(MSVC)

0 commit comments

Comments
 (0)