cmake: undo /var/empty workaround for Darwin SDK paths

With this workaround enabled, CMake looks for SDK headers and libraries
in `${SDKROOT}/var/empty`, which ensures it will not find them.
Disabling the workaround in just this case allows CMake’s SDK support to
work with the SDKs in nixpkgs while still not including other, impure
paths in its search paths.
This commit is contained in:
Randy Eckenrode
2024-10-10 16:23:00 -04:00
parent a556a81f12
commit 54d591b2b4
+8
View File
@@ -181,6 +181,14 @@ stdenv.mkDerivation (finalAttrs: {
sed -i 's|bin/cmake|${buildPackages.cmakeMinimal}/bin/cmake|g' Makefile
'';
# Undo some of `fixCmakeFiles` for Darwin to make sure that checks for libraries in the SDK find them
# (e.g., `find_library(MATH_LIBRARY m)` should find `$SDKROOT/usr/lib/libm.tbd`).
postFixup = lib.optionalString stdenv.hostPlatform.isDarwin ''
substituteInPlace "$out/share/cmake-${lib.versions.majorMinor finalAttrs.version}/Modules/Platform/Darwin.cmake" \
--replace-fail '/var/empty/include' '/usr/include' \
--replace-fail '/var/empty/lib' '/usr/lib'
'';
dontUseCmakeConfigure = true;
enableParallelBuilding = true;