Skip to content

Commit 52e6e93

Browse files
committed
Merge bitcoin/bitcoin#32693: depends: fix cmake compatibility error for freetype
d7c3790 build: patch cmake min version on freetype (josibake) Pull request description: ## Problem While doing a depends build with CMake 4.0.1, I got the following error: ``` Extracting freetype... /root/bitcoin/depends/sources/freetype-2.11.0.tar.xz: OK Preprocessing freetype... Configuring freetype... CMake Error at CMakeLists.txt:100 (cmake_minimum_required): Compatibility with CMake < 3.5 has been removed from CMake. Update the VERSION argument <min> value. Or, use the <min>...<max> syntax to tell CMake that the project requires at least <min> but has been updated to work with policies introduced by <max> or earlier. Or, add -DCMAKE_POLICY_VERSION_MINIMUM=3.5 to try configuring anyway. -- Configuring incomplete, errors occurred! make: *** [funcs.mk:343: /root/bitcoin/depends/x86_64-pc-linux-gnu/.freetype_stamp_configured] Error 1 make: Leaving directory '/root/bitcoin/depends' ``` .. which led me to https://cmake.org/cmake/help/latest/release/4.0.html#deprecated-and-removed-features, which states compatibility with CMake versions less than 3.5 has been removed in 4.0. ## Fix Based on the suggestion from the error message (and from reading the CMake docs), I added `-DCMAKE_POLICY_VERSION_MINIMUM=3.22`. I picked `3.22` (as opposed to 3.5) since that is the minimum version of CMake we specify in `doc/dependencies.md`. Would be nice if there was a way to pipe the min version in as a variable (since presumably we'd want to update this to be in lock step with the minimum CMake version of the whole project), but I couldn't think of a simple way to do this. Open to suggestions on a more robust way to do this if this is deemed too brittle. ACKs for top commit: fanquake: ACK d7c3790 hebasto: ACK d7c3790. Tested on Ubuntu 25.04 with both cmake 4.0.2 and the default cmake 3.31.6. Tree-SHA512: fb664ec73bfffc504f1dcc9076072307f443d056d14325de41c4a29f3ee4077f1922e79b5895b49e7354f45ad6a35be4973c153c2baf3376df6c0d209efc9c54
2 parents d91c718 + d7c3790 commit 52e6e93

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

depends/packages/freetype.mk

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ $(package)_download_path=https://download.savannah.gnu.org/releases/$(package)
44
$(package)_file_name=$(package)-$($(package)_version).tar.xz
55
$(package)_sha256_hash=8bee39bd3968c4804b70614a0a3ad597299ad0e824bc8aad5ce8aaf48067bde7
66
$(package)_build_subdir=build
7+
$(package)_patches += cmake_minimum.patch
78

89
define $(package)_set_vars
910
$(package)_config_opts := -DCMAKE_BUILD_TYPE=None -DBUILD_SHARED_LIBS=TRUE
@@ -12,6 +13,10 @@ define $(package)_set_vars
1213
$(package)_config_opts += -DCMAKE_DISABLE_FIND_PACKAGE_BrotliDec=TRUE
1314
endef
1415

16+
define $(package)_preprocess_cmds
17+
patch -p1 < $($(package)_patch_dir)/cmake_minimum.patch
18+
endef
19+
1520
define $(package)_config_cmds
1621
$($(package)_cmake) -S .. -B .
1722
endef
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
build: set minimum required CMake to 3.12
2+
3+
--- a/CMakeLists.txt
4+
+++ b/CMakeLists.txt
5+
@@ -97,7 +97,7 @@
6+
# FreeType explicitly marks the API to be exported and relies on the compiler
7+
# to hide all other symbols. CMake supports a C_VISBILITY_PRESET property
8+
# starting with 2.8.12.
9+
-cmake_minimum_required(VERSION 2.8.12)
10+
+cmake_minimum_required(VERSION 3.12)
11+
12+
if (NOT CMAKE_VERSION VERSION_LESS 3.3)
13+
# Allow symbol visibility settings also on static libraries. CMake < 3.3

0 commit comments

Comments
 (0)