1
0
Fork 0
cmake_helpers/target_link_static_libraries.cmake
Ilya Fedin 19381f859c Revert "Add DESKTOP_APP_USE_PACKAGED_FFMPEG_STATIC option"
This reverts commit 85759739eb.

I don't need this hack anymore since it doesn't work with Big Sur GitHub actions and I know anyone who uses it
2021-12-12 23:05:05 +04:00

45 lines
1.7 KiB
CMake

# This file is part of Desktop App Toolkit,
# a set of libraries for developing nice desktop applications.
#
# For license and copyright information please follow this link:
# https://github.com/desktop-app/legal/blob/master/LEGAL
function(target_link_static_libraries target_name)
set(list ${ARGV})
list(REMOVE_AT list 0)
set(writing_now "")
set(private_libs "")
set(public_libs "")
set(interface_libs "")
foreach (entry ${list})
if (${entry} STREQUAL "PRIVATE" OR ${entry} STREQUAL "PUBLIC" OR ${entry} STREQUAL "INTERFACE")
set(writing_now ${entry})
else()
find_library(static_lib_${entry} lib${entry}.a)
set(full_path "${static_lib_${entry}}")
if (${full_path} STREQUAL static_lib_${entry}-NOTFOUND)
message(FATAL_ERROR "Could not find static library lib${entry}.a")
endif()
if ("${writing_now}" STREQUAL "PRIVATE")
list(APPEND private_libs ${full_path})
elseif ("${writing_now}" STREQUAL "PUBLIC")
list(APPEND public_libs ${full_path})
elseif ("${writing_now}" STREQUAL "INTERFACE")
list(APPEND interface_libs ${full_path})
else()
message(FATAL_ERROR "Unknown frameworks scope for target ${target_name}")
endif()
endif()
endforeach()
if (NOT "${public_libs}" STREQUAL "")
target_link_libraries(${target_name} PUBLIC ${public_libs})
endif()
if (NOT "${private_libs}" STREQUAL "")
target_link_libraries(${target_name} PRIVATE ${private_libs})
endif()
if (NOT "${interface_libs}" STREQUAL "")
target_link_libraries(${target_name} INTERFACE ${interface_libs})
endif()
endfunction()