Skip to content

Commit 3af7198

Browse files
committed
cmake: Bump minimum required CMake version to 3.22
Ubuntu 20.04 LTS has reached 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 change also introduces new CMake policies, from CMP0098 to CMP0128.
1 parent 9239447 commit 3af7198

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)