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 0670687b86
commit 56b59c767b
1 changed files with 4 additions and 0 deletions

View File

@ -236,6 +236,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")
if(NOT CMAKE_SYSTEM_VERSION VERSION_LESS "10.0") # Darwin 10.x is Mac OS X 10.6