Skip to content

Commit 0e9e25d

Browse files
authored
ICU: CMake 4+ compatibility (#852)
Set `CMAKE_POLICY_VERSION_MINIMUM=3.5` to make the project work with CMake 4+. This fixes the following error: ``` CMake Error at CMakeLists.txt (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. ```
1 parent dba5f7f commit 0e9e25d

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

cmake/projects/ICU/hunter.cmake

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
include(hunter_add_version)
77
include(hunter_cacheable)
8+
include(hunter_cmake_args)
89
include(hunter_download)
910
include(hunter_pick_scheme)
1011

@@ -107,6 +108,18 @@ hunter_add_version(
107108
506109ef6fa0c3105be64bcebb5bd9e3fba1a24f
108109
)
109110

111+
if(HUNTER_ICU_VERSION VERSION_LESS 63.2)
112+
# CMake 4.0+ compatibility with older ICU packages
113+
set(_hunter_ICU_cmake_compatibility_flag "CMAKE_POLICY_VERSION_MINIMUM=3.5")
114+
else()
115+
set(_hunter_ICU_cmake_compatibility_flag "")
116+
endif()
117+
if(NOT _hunter_ICU_cmake_compatibility_flag STREQUAL "")
118+
hunter_cmake_args(ICU CMAKE_ARGS
119+
${_hunter_ICU_cmake_compatibility_flag}
120+
)
121+
endif()
122+
110123
hunter_pick_scheme(DEFAULT url_sha1_cmake)
111124
hunter_cacheable(ICU)
112125
hunter_download(PACKAGE_NAME ICU)

0 commit comments

Comments
 (0)