CMake: Default macOS SDK version to OS version if not found

This commit is contained in:
Vicki Pfau 2025-01-19 18:41:06 -08:00
parent e518a5ced0
commit ed64b35db7
1 changed files with 4 additions and 0 deletions

View File

@ -241,6 +241,10 @@ endif()
if(APPLE)
execute_process(COMMAND xcrun --show-sdk-version OUTPUT_VARIABLE MACOSX_SDK)
if(NOT MACOSX_SDK)
message(WARNING "Could not detect SDK version; defaulting to system version. Is SDKROOT set?")
set(MACOSX_SDK ${CMAKE_SYSTEM_VERSION})
endif()
add_definitions(-D_DARWIN_C_SOURCE)
list(APPEND OS_LIB "-framework Foundation")