Skip to content

Commit b66a6d3

Browse files
committed
ci: Fix shell.nix compatibility with CMake 4.0
CMake 4.0 dropped support for older policies, so versions of Cap'n Proto <= v1.1.0 (before capnproto/capnproto#2272) require an additional option to build with cmake 4.0. This problem does not affect the olddeps job because olddeps uses an old version of Cap'n Proto together with an old version of cmake. But in a custom config, specifying an older capnprotoVersion argument to shell.nix would cause errors like: > 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. This change fixes the problem by specifying -DCMAKE_POLICY_VERSION_MINIMUM=3.5 when needed.
1 parent 2e9436c commit b66a6d3

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

shell.nix

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ let
3939
hash = lib.attrByPath [capnprotoVersion] "" capnprotoHashes;
4040
};
4141
patches = lib.optionals (lib.versionAtLeast capnprotoVersion "0.9.0" && lib.versionOlder capnprotoVersion "0.10.4") [ ./ci/patches/spaceship.patch ];
42+
cmakeFlags = (old.cmakeFlags or []) ++ (lib.optionals (lib.versionAtLeast "1.1.0" capnprotoVersion) ["-DCMAKE_POLICY_VERSION_MINIMUM=3.5"]);
4243
} // (lib.optionalAttrs (lib.versionOlder capnprotoVersion "0.10") {
4344
env = { }; # Drop -std=c++20 flag forced by nixpkgs
4445
}));

0 commit comments

Comments
 (0)