Move apple framework linking into a reusable function

This commit is contained in:
Georg Hagen
2024-05-27 10:23:02 +02:00
parent b462167760
commit 8875a2d4ee
2 changed files with 30 additions and 27 deletions

29
cmake/AppleHelper.cmake Normal file
View File

@@ -0,0 +1,29 @@
function(LinkAppleFrameworks TARGET)
target_link_libraries(${TARGET}
PUBLIC "-framework CoreFoundation"
PUBLIC "-framework Foundation"
PUBLIC "-framework CoreImage"
PUBLIC "-framework CoreVideo"
PUBLIC "-framework Metal"
PUBLIC "-framework MetalPerformanceShaders"
PUBLIC "-framework ARKit"
PUBLIC "-lstdc++"
PUBLIC c++
PUBLIC c
)
# Locate system libraries on iOS
find_library(UIKIT UIKit)
find_library(FOUNDATION Foundation)
find_library(MOBILECORESERVICES MobileCoreServices)
find_library(CFNETWORK CFNetwork)
find_library(SYSTEMCONFIGURATION SystemConfiguration)
# link the frameworks located above
target_link_libraries(${TARGET} PUBLIC ${UIKIT})
target_link_libraries(${TARGET} PUBLIC ${FOUNDATION})
target_link_libraries(${TARGET} PUBLIC ${MOBILECORESERVICES})
target_link_libraries(${TARGET} PUBLIC ${CFNETWORK})
target_link_libraries(${TARGET} PUBLIC ${SYSTEMCONFIGURATION})
endfunction()