Skip to content

Commit dba5f7f

Browse files
authored
gflags: CMake 4+ compatibility (#851)
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 07b8c97 commit dba5f7f

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

cmake/projects/gflags/hunter.cmake

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,18 @@ hunter_add_version(
5353
4d42470afb7236fb0cf90f8bbb0cec588073c17c
5454
)
5555

56+
if(HUNTER_glfags_VERSION VERSION_LESS_EQUAL 2.2.2)
57+
# CMake 4.0+ compatibility with older glfags packages
58+
set(_hunter_glfags_cmake_compatibility_flag "CMAKE_POLICY_VERSION_MINIMUM=3.5")
59+
else()
60+
set(_hunter_glfags_cmake_compatibility_flag "")
61+
endif()
62+
5663
hunter_cmake_args(
5764
gflags
5865
CMAKE_ARGS
5966
REGISTER_INSTALL_PREFIX=OFF
67+
${_hunter_glfags_cmake_compatibility_flag}
6068
)
6169

6270
hunter_pick_scheme(DEFAULT url_sha1_cmake)

0 commit comments

Comments
 (0)