1
0
Fork 0

Allow weak-linking of macOS frameworks.

This commit is contained in:
John Preston 2023-01-09 10:24:32 +04:00
parent de92292f89
commit aa1e0d84b9
2 changed files with 11 additions and 3 deletions

View file

@ -84,5 +84,4 @@ INTERFACE
MediaPlayer
IOSurface
Metal
NaturalLanguage
)

View file

@ -4,8 +4,9 @@
# For license and copyright information please follow this link:
# https://github.com/desktop-app/legal/blob/master/LEGAL
function(target_link_frameworks target_name)
function(target_link_frameworks_generic type target_name)
set(list ${ARGV})
list(REMOVE_AT list 1)
list(REMOVE_AT list 0)
set(writing_now "")
@ -16,7 +17,7 @@ function(target_link_frameworks target_name)
if (${entry} STREQUAL "PRIVATE" OR ${entry} STREQUAL "PUBLIC" OR ${entry} STREQUAL "INTERFACE")
set(writing_now ${entry})
else()
set(full_argument "-framework ${entry}")
set(full_argument "${type} ${entry}")
if ("${writing_now}" STREQUAL "PRIVATE")
list(APPEND private_frameworks ${full_argument})
elseif ("${writing_now}" STREQUAL "PUBLIC")
@ -39,3 +40,11 @@ function(target_link_frameworks target_name)
target_link_libraries(${target_name} INTERFACE ${interface_frameworks})
endif()
endfunction()
function(target_link_frameworks target_name)
target_link_frameworks_generic("-framework" ${ARGV})
endfunction()
function(target_link_frameworks_weak target_name)
target_link_frameworks_generic("-weak_framework" ${ARGV})
endfunction()