1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-10 23:44:24 +00:00

CMake: Add support for windowLibs, OSXLibs, and iOSLibs when using modules with CMake

This commit is contained in:
reuk 2020-04-27 22:08:34 +01:00 committed by Reuben Thomas
parent e19b724ec8
commit 440a9690b4

View file

@ -416,6 +416,16 @@ endfunction()
# ================================================================================================== # ==================================================================================================
function(_juce_link_libs_from_metadata module_name dict key)
_juce_get_metadata("${dict}" "${key}" libs)
if(libs)
target_link_libraries(${module_name} INTERFACE ${libs})
endif()
endfunction()
# ==================================================================================================
function(juce_add_module module_path) function(juce_add_module module_path)
set(one_value_args INSTALL_PATH INSTALL_EXPORT ALIAS_NAMESPACE) set(one_value_args INSTALL_PATH INSTALL_EXPORT ALIAS_NAMESPACE)
cmake_parse_arguments(JUCE_ARG "" "${one_value_args}" "" ${ARGN}) cmake_parse_arguments(JUCE_ARG "" "${one_value_args}" "" ${ARGN})
@ -521,6 +531,8 @@ function(juce_add_module module_path)
find_library("${module_name}_${module_framework}" ${module_framework} REQUIRED) find_library("${module_name}_${module_framework}" ${module_framework} REQUIRED)
target_link_libraries(${module_name} INTERFACE "${${module_name}_${module_framework}}") target_link_libraries(${module_name} INTERFACE "${${module_name}_${module_framework}}")
endforeach() endforeach()
_juce_link_libs_from_metadata("${module_name}" "${metadata_dict}" OSXLibs)
elseif(CMAKE_SYSTEM_NAME STREQUAL "iOS") elseif(CMAKE_SYSTEM_NAME STREQUAL "iOS")
_juce_get_metadata("${metadata_dict}" iOSFrameworks module_iosframeworks) _juce_get_metadata("${metadata_dict}" iOSFrameworks module_iosframeworks)
@ -532,6 +544,8 @@ function(juce_add_module module_path)
find_library("${module_name}_${module_framework}" ${module_framework} REQUIRED) find_library("${module_name}_${module_framework}" ${module_framework} REQUIRED)
target_link_libraries(${module_name} INTERFACE "${${module_name}_${module_framework}}") target_link_libraries(${module_name} INTERFACE "${${module_name}_${module_framework}}")
endforeach() endforeach()
_juce_link_libs_from_metadata("${module_name}" "${metadata_dict}" iOSLibs)
elseif(CMAKE_SYSTEM_NAME STREQUAL "Linux") elseif(CMAKE_SYSTEM_NAME STREQUAL "Linux")
_juce_get_metadata("${metadata_dict}" linuxPackages module_linuxpackages) _juce_get_metadata("${metadata_dict}" linuxPackages module_linuxpackages)
@ -540,13 +554,11 @@ function(juce_add_module module_path)
target_link_libraries(${module_name} INTERFACE juce::pkgconfig_${module_name}_LINUX_DEPS) target_link_libraries(${module_name} INTERFACE juce::pkgconfig_${module_name}_LINUX_DEPS)
endif() endif()
_juce_get_metadata("${metadata_dict}" linuxLibs module_linuxlibs) _juce_link_libs_from_metadata("${module_name}" "${metadata_dict}" linuxLibs)
if(module_linuxlibs)
target_link_libraries(${module_name} INTERFACE ${module_linuxlibs})
endif()
elseif(CMAKE_SYSTEM_NAME STREQUAL "Windows") elseif(CMAKE_SYSTEM_NAME STREQUAL "Windows")
target_compile_options(${module_name} INTERFACE /bigobj) target_compile_options(${module_name} INTERFACE /bigobj)
_juce_link_libs_from_metadata("${module_name}" "${metadata_dict}" windowsLibs)
endif() endif()
_juce_get_metadata("${metadata_dict}" dependencies module_dependencies) _juce_get_metadata("${metadata_dict}" dependencies module_dependencies)