mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2026-03-18 19:32:41 +00:00
CMake: Error out when switching sources for dependencies
Currently, configuring from System>Bundled doesn't work, it instead produces cryptic errors. And configuring from Bundled>System wont produce errors, but wont use the system libraries either. This change produces a clear error in both cases.
This commit is contained in:
parent
2a3078b833
commit
11065e9911
@ -50,6 +50,17 @@ function(dolphin_add_bundled_library library use_system bundled_path)
|
||||
add_subdirectory(${bundled_path} EXCLUDE_FROM_ALL)
|
||||
endfunction()
|
||||
|
||||
function(dolphin_set_library_type library type)
|
||||
if(DEFINED ${library}_TYPE AND NOT ${${library}_TYPE} STREQUAL "${type}")
|
||||
message(FATAL_ERROR
|
||||
"The selection for ${library} changed from '${${library}_TYPE}' to '${type}' after configuration.\n"
|
||||
"Please delete the build directory (or at least CMakeCache.txt) and reconfigure."
|
||||
)
|
||||
endif()
|
||||
|
||||
set(${library}_TYPE "${type}" CACHE INTERNAL "")
|
||||
endfunction()
|
||||
|
||||
function(dolphin_find_optional_system_library library bundled_path)
|
||||
dolphin_optional_system_library(use_system ${library})
|
||||
string(TOUPPER ${library} upperlib)
|
||||
@ -101,11 +112,11 @@ function(dolphin_find_optional_system_library library bundled_path)
|
||||
endif()
|
||||
endif()
|
||||
if(${prefix}_FOUND)
|
||||
dolphin_set_library_type(${library} "System")
|
||||
message(STATUS "Using system ${library}")
|
||||
set(${prefix}_TYPE "System" PARENT_SCOPE)
|
||||
else()
|
||||
dolphin_set_library_type(${library} "Bundled")
|
||||
dolphin_add_bundled_library(${library} ${use_system} ${bundled_path})
|
||||
set(${prefix}_TYPE "Bundled" PARENT_SCOPE)
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
@ -119,11 +130,11 @@ function(dolphin_find_optional_system_library_pkgconfig library search alias bun
|
||||
endif()
|
||||
endif()
|
||||
if(${library}_FOUND)
|
||||
dolphin_set_library_type(${library} "System")
|
||||
message(STATUS "Using system ${library}")
|
||||
dolphin_alias_library(${alias} PkgConfig::${library})
|
||||
set(${library}_TYPE "System" PARENT_SCOPE)
|
||||
else()
|
||||
dolphin_set_library_type(${library} "Bundled")
|
||||
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