mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2024-11-14 05:17:44 -07:00
CMake: Pass RESOLVED_USE_SYSTEM_<lib> as a parameter
Because we were setting it with a scope, it wasn't making its way into called functions that would try to inspect it. Now it does.
This commit is contained in:
parent
432d4a2a06
commit
613c959bda
@ -19,28 +19,27 @@ function(dolphin_make_imported_target_if_missing target lib)
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
function(dolphin_optional_system_library library)
|
||||
function(dolphin_optional_system_library out_use_system library)
|
||||
string(TOUPPER ${library} upperlib)
|
||||
set(USE_SYSTEM_${upperlib} "" CACHE STRING "Use system ${library} instead of bundled. ON - Always use system and fail if unavailable, OFF - Always use bundled, AUTO - Use system if available, otherwise use bundled, blank - Delegate to USE_SYSTEM_LIBS. Default is blank.")
|
||||
if("${USE_SYSTEM_${upperlib}}" STREQUAL "")
|
||||
if(APPROVED_VENDORED_DEPENDENCIES)
|
||||
string(TOLOWER ${library} lowerlib)
|
||||
if(lowerlib IN_LIST APPROVED_VENDORED_DEPENDENCIES)
|
||||
set(RESOLVED_USE_SYSTEM_${upperlib} AUTO PARENT_SCOPE)
|
||||
set(${out_use_system} AUTO PARENT_SCOPE)
|
||||
else()
|
||||
set(RESOLVED_USE_SYSTEM_${upperlib} ON PARENT_SCOPE)
|
||||
set(${out_use_system} ON PARENT_SCOPE)
|
||||
endif()
|
||||
else()
|
||||
set(RESOLVED_USE_SYSTEM_${upperlib} ${USE_SYSTEM_LIBS} PARENT_SCOPE)
|
||||
set(${out_use_system} ${USE_SYSTEM_LIBS} PARENT_SCOPE)
|
||||
endif()
|
||||
else()
|
||||
set(RESOLVED_USE_SYSTEM_${upperlib} ${USE_SYSTEM_${upperlib}} PARENT_SCOPE)
|
||||
set(${out_use_system} ${USE_SYSTEM_${upperlib}} PARENT_SCOPE)
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
function(dolphin_add_bundled_library library bundled_path)
|
||||
string(TOUPPER ${library} upperlib)
|
||||
if (${RESOLVED_USE_SYSTEM_${upperlib}} STREQUAL "AUTO")
|
||||
function(dolphin_add_bundled_library library use_system bundled_path)
|
||||
if (${use_system} STREQUAL "AUTO")
|
||||
message(STATUS "No system ${library} was found. Using static ${library} from Externals.")
|
||||
else()
|
||||
message(STATUS "Using static ${library} from Externals")
|
||||
@ -52,9 +51,9 @@ function(dolphin_add_bundled_library library bundled_path)
|
||||
endfunction()
|
||||
|
||||
function(dolphin_find_optional_system_library library bundled_path)
|
||||
dolphin_optional_system_library(${library})
|
||||
dolphin_optional_system_library(use_system ${library})
|
||||
string(TOUPPER ${library} upperlib)
|
||||
if(RESOLVED_USE_SYSTEM_${upperlib})
|
||||
if(use_system)
|
||||
find_package(${library} ${ARGN})
|
||||
# Yay for cmake packages being inconsistent
|
||||
if(DEFINED ${library}_FOUND)
|
||||
@ -62,7 +61,7 @@ function(dolphin_find_optional_system_library library bundled_path)
|
||||
else()
|
||||
set(prefix ${upperlib})
|
||||
endif()
|
||||
if((NOT ${prefix}_FOUND) AND (NOT ${RESOLVED_USE_SYSTEM_${upperlib}} STREQUAL "AUTO"))
|
||||
if((NOT ${prefix}_FOUND) AND (NOT ${use_system} STREQUAL "AUTO"))
|
||||
message(FATAL_ERROR "No system ${library} was found. Please install it or set USE_SYSTEM_${upperlib} to AUTO or OFF.")
|
||||
endif()
|
||||
endif()
|
||||
@ -70,17 +69,17 @@ function(dolphin_find_optional_system_library library bundled_path)
|
||||
message(STATUS "Using system ${library}")
|
||||
set(${prefix}_TYPE "System" PARENT_SCOPE)
|
||||
else()
|
||||
dolphin_add_bundled_library(${library} ${bundled_path})
|
||||
dolphin_add_bundled_library(${library} ${use_system} ${bundled_path})
|
||||
set(${prefix}_TYPE "Bundled" PARENT_SCOPE)
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
function(dolphin_find_optional_system_library_pkgconfig library search alias bundled_path)
|
||||
dolphin_optional_system_library(${library})
|
||||
dolphin_optional_system_library(use_system ${library})
|
||||
string(TOUPPER ${library} upperlib)
|
||||
if(RESOLVED_USE_SYSTEM_${upperlib})
|
||||
if(use_system)
|
||||
pkg_search_module(${library} ${search} ${ARGN} IMPORTED_TARGET)
|
||||
if((NOT ${library}_FOUND) AND (NOT ${RESOLVED_USE_SYSTEM_${upperlib}} STREQUAL "AUTO"))
|
||||
if((NOT ${library}_FOUND) AND (NOT ${use_system} STREQUAL "AUTO"))
|
||||
message(FATAL_ERROR "No system ${library} was found. Please install it or set USE_SYSTEM_${upperlib} to AUTO or OFF.")
|
||||
endif()
|
||||
endif()
|
||||
@ -89,7 +88,7 @@ function(dolphin_find_optional_system_library_pkgconfig library search alias bun
|
||||
dolphin_alias_library(${alias} PkgConfig::${library})
|
||||
set(${library}_TYPE "System" PARENT_SCOPE)
|
||||
else()
|
||||
dolphin_add_bundled_library(${library} ${bundled_path})
|
||||
dolphin_add_bundled_library(${library} ${use_system} ${bundled_path})
|
||||
set(${library}_TYPE "Bundled" PARENT_SCOPE)
|
||||
endif()
|
||||
endfunction()
|
||||
|
Loading…
Reference in New Issue
Block a user