Fails to build (configure) with CMake >=4.0
I am unable to build pg_top using CMake 4.0.1:
> cmake CMakeLists.txt
CMake Error at CMakeLists.txt:1 (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!
Adding the -DCMAKE_POLICY_VERSION_MINIMUM=3.5 override as suggested fixes the issue, although it still gives a warning:
> cmake -DCMAKE_POLICY_VERSION_MINIMUM=3.5 CMakeLists.txt
CMake Deprecation Warning at CMakeLists.txt:1 (cmake_minimum_required):
Compatibility with CMake < 3.10 will be removed from a future version of
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.
-- The C compiler identification is GNU 14.2.1
...
I don't really know much about CMake, but I tried changing the cmake_minimum_required(3.1.0) line to cmake_minimum_required(3.1.0...4.0.0), and that seemed to fix everything.