From 7d718ada390bc54749fa35389437147e1bbefae1 Mon Sep 17 00:00:00 2001 From: Nadia Holmquist Pedersen Date: Thu, 5 Dec 2024 15:38:44 +0100 Subject: [PATCH] cmake: set default CMAKE_OSX_DEPLOYMENT_TARGET before project() project() appears to set it to an empty string (the value of nonexistent $ENV{MACOSX_DEPLOYMENT_TARGET}?), causing our attempt to set its default to fail. CMake bug? --- CMakeLists.txt | 3 +-- flake.nix | 6 ++++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c54b6450..531ca19f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -9,6 +9,7 @@ set(CMAKE_POLICY_DEFAULT_CMP0069 NEW) set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake" ${CMAKE_MODULE_PATH}) set(CMAKE_USER_MAKE_RULES_OVERRIDE "${CMAKE_CURRENT_SOURCE_DIR}/cmake/DefaultBuildFlags.cmake") +set(CMAKE_OSX_DEPLOYMENT_TARGET "10.15" CACHE STRING "Minimum OS X deployment version") option(USE_VCPKG "Use vcpkg for dependency packages" OFF) if (USE_VCPKG) @@ -29,8 +30,6 @@ include(CheckIPOSupported) include(SetupCCache) include(Sanitizers) -set(CMAKE_OSX_DEPLOYMENT_TARGET "10.15" CACHE STRING "Minimum OS X deployment version") - set(CMAKE_C_STANDARD 11) set(CMAKE_C_STANDARD_REQUIRED ON) set(CMAKE_CXX_STANDARD 17) diff --git a/flake.nix b/flake.nix index 7d17bb27..8dedde8f 100644 --- a/flake.nix +++ b/flake.nix @@ -95,7 +95,13 @@ libtool ninja pkg-config + python3 ]; + + # Undo the SDK setup done by nixpkgs so we can use AppleClang + shellHook = '' + unset DEVELOPER_DIR SDKROOT MACOSX_DEPLOYMENT_TARGET + ''; }; }; }