summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CMake/DolphinLibraryTools.cmake19
1 files changed, 15 insertions, 4 deletions
diff --git a/CMake/DolphinLibraryTools.cmake b/CMake/DolphinLibraryTools.cmake
index f2305d8399..bedba9dcbd 100644
--- a/CMake/DolphinLibraryTools.cmake
+++ b/CMake/DolphinLibraryTools.cmake
@@ -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()