build: enhance CMakeLists to dynamically detect kernel version to utilize (#4828)

This commit is contained in:
PastaPastaPasta 2022-05-09 06:13:49 -05:00 committed by GitHub
parent a356832882
commit fc9a6f8ff6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -21,10 +21,16 @@ if(UNIX AND NOT APPLE)
set(DEPENDS_PREFIX depends/x86_64-pc-linux-gnu) set(DEPENDS_PREFIX depends/x86_64-pc-linux-gnu)
elseif(APPLE) elseif(APPLE)
EXECUTE_PROCESS( COMMAND uname -m COMMAND tr -d '\n' OUTPUT_VARIABLE ARCHITECTURE ) EXECUTE_PROCESS( COMMAND uname -m COMMAND tr -d '\n' OUTPUT_VARIABLE ARCHITECTURE )
EXECUTE_PROCESS( COMMAND system_profiler -detailLevel mini -json SPSoftwareDataType
COMMAND jq .SPSoftwareDataType
COMMAND jq .[]
COMMAND jq .kernel_version
COMMAND tr -d "Dawrin\" "
OUTPUT_VARIABLE DARWIN_KERNEL_VERSION)
if( ${ARCHITECTURE} STREQUAL "arm64" ) if( ${ARCHITECTURE} STREQUAL "arm64" )
set(DEPENDS_PREFIX depends/aarch64-apple-darwin21.2.0) set(DEPENDS_PREFIX depends/aarch64-apple-darwin${DARWIN_KERNEL_VERSION})
else() else()
set(DEPENDS_PREFIX depends/x86_64-apple-darwin19) set(DEPENDS_PREFIX depends/x86_64-apple-darwin${DARWIN_KERNEL_VERSION})
endif() endif()
elseif(WIN32) elseif(WIN32)
set(DEPENDS_PREFIX depends/x86_64-w64-mingw32) set(DEPENDS_PREFIX depends/x86_64-w64-mingw32)