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:
@@ -50,6 +50,17 @@ function(dolphin_add_bundled_library library use_system bundled_path)
|
|||||||
add_subdirectory(${bundled_path} EXCLUDE_FROM_ALL)
|
add_subdirectory(${bundled_path} EXCLUDE_FROM_ALL)
|
||||||
endfunction()
|
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)
|
function(dolphin_find_optional_system_library library bundled_path)
|
||||||
dolphin_optional_system_library(use_system ${library})
|
dolphin_optional_system_library(use_system ${library})
|
||||||
string(TOUPPER ${library} upperlib)
|
string(TOUPPER ${library} upperlib)
|
||||||
@@ -101,11 +112,11 @@ function(dolphin_find_optional_system_library library bundled_path)
|
|||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
if(${prefix}_FOUND)
|
if(${prefix}_FOUND)
|
||||||
|
dolphin_set_library_type(${library} "System")
|
||||||
message(STATUS "Using system ${library}")
|
message(STATUS "Using system ${library}")
|
||||||
set(${prefix}_TYPE "System" PARENT_SCOPE)
|
|
||||||
else()
|
else()
|
||||||
|
dolphin_set_library_type(${library} "Bundled")
|
||||||
dolphin_add_bundled_library(${library} ${use_system} ${bundled_path})
|
dolphin_add_bundled_library(${library} ${use_system} ${bundled_path})
|
||||||
set(${prefix}_TYPE "Bundled" PARENT_SCOPE)
|
|
||||||
endif()
|
endif()
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
@@ -119,11 +130,11 @@ function(dolphin_find_optional_system_library_pkgconfig library search alias bun
|
|||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
if(${library}_FOUND)
|
if(${library}_FOUND)
|
||||||
|
dolphin_set_library_type(${library} "System")
|
||||||
message(STATUS "Using system ${library}")
|
message(STATUS "Using system ${library}")
|
||||||
dolphin_alias_library(${alias} PkgConfig::${library})
|
dolphin_alias_library(${alias} PkgConfig::${library})
|
||||||
set(${library}_TYPE "System" PARENT_SCOPE)
|
|
||||||
else()
|
else()
|
||||||
|
dolphin_set_library_type(${library} "Bundled")
|
||||||
dolphin_add_bundled_library(${library} ${use_system} ${bundled_path})
|
dolphin_add_bundled_library(${library} ${use_system} ${bundled_path})
|
||||||
set(${library}_TYPE "Bundled" PARENT_SCOPE)
|
|
||||||
endif()
|
endif()
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|||||||
Reference in New Issue
Block a user