CMake: Set macOS deployment target for vcpkg ports to match our build

Without this, ports get built with whatever default is there from the
toolchain, and we get all sorts of linker warnings about a mismatch.
This commit is contained in:
Andrew Kaster 2025-05-29 20:20:06 -06:00 committed by Tim Flynn
commit 68bba89dc3
Notes: github-actions[bot] 2025-05-30 16:55:17 +00:00
3 changed files with 8 additions and 4 deletions

View file

@ -10,6 +10,10 @@ endif()
# vcpkg flags depend on what linker we are using
include("Meta/CMake/use_linker.cmake")
if (APPLE AND NOT CMAKE_OSX_DEPLOYMENT_TARGET)
set(CMAKE_OSX_DEPLOYMENT_TARGET 14.0)
endif()
# Pass additional information to vcpkg toolchain files if we are using vcpkg.
if (CMAKE_TOOLCHAIN_FILE MATCHES "vcpkg.cmake$")
set(CMAKE_PROJECT_ladybird_INCLUDE_BEFORE "Meta/CMake/vcpkg/generate_vcpkg_toolchain_variables.cmake")

View file

@ -41,10 +41,6 @@ serenity_option(ENABLE_SWIFT OFF CACHE BOOL "Enable building Swift files")
serenity_option(ENABLE_STD_STACKTRACE OFF CACHE BOOL "Force use of std::stacktrace instead of libbacktrace. If it is not supported the build will fail")
serenity_option(ENABLE_WINDOWS_CI OFF CACHE BOOL "Enable building targets supported on Windows for CI")
if (APPLE AND NOT CMAKE_OSX_DEPLOYMENT_TARGET)
set(CMAKE_OSX_DEPLOYMENT_TARGET 14.0)
endif()
if (ENABLE_SWIFT)
include(${CMAKE_CURRENT_LIST_DIR}/Swift/swift-settings.cmake)
endif()

View file

@ -17,6 +17,10 @@ if (LINUX AND NOT LAGOM_USE_LINKER)
string(APPEND EXTRA_VCPKG_VARIABLES "set(ENV{LDFLAGS} -Wl,-z,noseparate-code)\n")
endif()
if (CMAKE_OSX_DEPLOYMENT_TARGET)
string(APPEND EXTRA_VCPKG_VARIABLES "set(VCPKG_OSX_DEPLOYMENT_TARGET ${CMAKE_OSX_DEPLOYMENT_TARGET})\n")
endif()
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/build-vcpkg-variables.cmake" "${EXTRA_VCPKG_VARIABLES}")
# Munge the VCPKG_TRIPLET to correspond to the right one for our presets