1 parent
8583a479dd
commit
3851aeb703
42 files changed
+6948
-759
No files matched your search
@@ -64,6 +64,13 @@ function(void_fetch_dependency DEP_NAME)
|
||||
INTERFACE_LINK_LIBRARIES PkgConfig::SODIUM)
|
||||
return()
|
||||
endif()
|
||||
|
||||
if(DEP_NAME STREQUAL "LibArchive")
|
||||
if(NOT TARGET LibArchive::LibArchive)
|
||||
find_package(LibArchive REQUIRED)
|
||||
endif()
|
||||
return()
|
||||
endif()
|
||||
# FIXME: Add if needed external
|
||||
# if(DEP_NAME STREQUAL "glaze")
|
||||
# if(NOT glaze_POPULATED)
|
||||
|
||||
+21
-2
@@ -1,5 +1,5 @@
|
||||
set_property(GLOBAL PROPERTY VOID_MODULES "")
|
||||
set_property(GLOBAL PROPERTY VOID_EXT_DEPS "")
|
||||
set_property(GLOBAL PROPERTY VOID_MODULE_DEPENDENCY_RECORDS "")
|
||||
set_property(GLOBAL PROPERTY VOID_PENDING_OPTIONAL_DEPS "")
|
||||
|
||||
function(void_add_module MODULE_NAME)
|
||||
@@ -38,13 +38,32 @@ function(void_add_module MODULE_NAME)
|
||||
add_library(${ALIAS} ALIAS ${TGT})
|
||||
|
||||
set_property(GLOBAL APPEND PROPERTY VOID_MODULES ${MODULE_NAME})
|
||||
set(_module_external_deps "")
|
||||
foreach(ext_dep IN LISTS ARG_EXTERNAL_DEPS)
|
||||
string(REGEX REPLACE "::.*" "" BASE_DEP ${ext_dep})
|
||||
set_property(GLOBAL APPEND PROPERTY VOID_EXT_DEPS ${BASE_DEP})
|
||||
list(APPEND _module_external_deps ${BASE_DEP})
|
||||
include(cmake/Dependencies.cmake)
|
||||
void_fetch_dependency(${BASE_DEP})
|
||||
endforeach()
|
||||
|
||||
set(_module_internal_deps ${ARG_INTERNAL_DEPS} ${ARG_OPTIONAL_DEPS})
|
||||
if(_module_internal_deps)
|
||||
list(REMOVE_DUPLICATES _module_internal_deps)
|
||||
string(REPLACE ";" "," _module_internal_record
|
||||
"${_module_internal_deps}")
|
||||
else()
|
||||
set(_module_internal_record "-")
|
||||
endif()
|
||||
if(_module_external_deps)
|
||||
list(REMOVE_DUPLICATES _module_external_deps)
|
||||
string(REPLACE ";" "," _module_external_record
|
||||
"${_module_external_deps}")
|
||||
else()
|
||||
set(_module_external_record "-")
|
||||
endif()
|
||||
set_property(GLOBAL APPEND PROPERTY VOID_MODULE_DEPENDENCY_RECORDS
|
||||
"${MODULE_NAME}|${_module_internal_record}|${_module_external_record}")
|
||||
|
||||
foreach(int_dep IN LISTS ARG_INTERNAL_DEPS)
|
||||
target_link_libraries(${TGT} ${SCOPE} ${PROJECT_NAME}::${int_dep})
|
||||
endforeach()
|
||||
|
||||
@@ -2,7 +2,66 @@
|
||||
|
||||
include(CMakeFindDependencyMacro)
|
||||
|
||||
set(_void_external_deps "@VOID_EXTERNAL_DEPS_LIST@")
|
||||
set(_void_known_modules "@VOID_MODULES_LIST@")
|
||||
set(_void_module_dependency_records "@VOID_MODULE_DEPENDENCY_RECORDS@")
|
||||
|
||||
function(_void_module_dependencies module out_internal out_external)
|
||||
foreach(record IN LISTS _void_module_dependency_records)
|
||||
string(REPLACE "|" ";" fields "${record}")
|
||||
list(GET fields 0 record_module)
|
||||
if(NOT record_module STREQUAL module)
|
||||
continue()
|
||||
endif()
|
||||
|
||||
list(GET fields 1 internal_csv)
|
||||
list(GET fields 2 external_csv)
|
||||
if(internal_csv STREQUAL "-")
|
||||
set(internal "")
|
||||
else()
|
||||
string(REPLACE "," ";" internal "${internal_csv}")
|
||||
endif()
|
||||
if(external_csv STREQUAL "-")
|
||||
set(external "")
|
||||
else()
|
||||
string(REPLACE "," ";" external "${external_csv}")
|
||||
endif()
|
||||
set(${out_internal} "${internal}" PARENT_SCOPE)
|
||||
set(${out_external} "${external}" PARENT_SCOPE)
|
||||
return()
|
||||
endforeach()
|
||||
set(${out_internal} "" PARENT_SCOPE)
|
||||
set(${out_external} "" PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
# With no requested components, preserve the historical all-modules package
|
||||
# behavior. Component-aware consumers resolve only the transitive dependencies
|
||||
# of the modules they explicitly request.
|
||||
if(Void_FIND_COMPONENTS)
|
||||
set(_void_pending_modules ${Void_FIND_COMPONENTS})
|
||||
else()
|
||||
set(_void_pending_modules ${_void_known_modules})
|
||||
endif()
|
||||
|
||||
set(_void_required_modules "")
|
||||
while(_void_pending_modules)
|
||||
list(POP_FRONT _void_pending_modules module)
|
||||
if(NOT module IN_LIST _void_known_modules OR
|
||||
module IN_LIST _void_required_modules)
|
||||
continue()
|
||||
endif()
|
||||
list(APPEND _void_required_modules "${module}")
|
||||
_void_module_dependencies("${module}" internal_deps external_deps)
|
||||
list(APPEND _void_pending_modules ${internal_deps})
|
||||
endwhile()
|
||||
|
||||
set(_void_external_deps "")
|
||||
foreach(module IN LISTS _void_required_modules)
|
||||
_void_module_dependencies("${module}" internal_deps external_deps)
|
||||
list(APPEND _void_external_deps ${external_deps})
|
||||
endforeach()
|
||||
if(_void_external_deps)
|
||||
list(REMOVE_DUPLICATES _void_external_deps)
|
||||
endif()
|
||||
foreach(dep IN LISTS _void_external_deps)
|
||||
if(dep STREQUAL "Boost")
|
||||
find_dependency(Boost REQUIRED COMPONENTS stacktrace_backtrace url)
|
||||
@@ -14,6 +73,8 @@ foreach(dep IN LISTS _void_external_deps)
|
||||
set_property(TARGET Sodium::Sodium PROPERTY
|
||||
INTERFACE_LINK_LIBRARIES PkgConfig::SODIUM)
|
||||
endif()
|
||||
elseif(dep STREQUAL "LibArchive")
|
||||
find_dependency(LibArchive REQUIRED)
|
||||
elseif(NOT TARGET ${dep})
|
||||
find_dependency(${dep})
|
||||
endif()
|
||||
@@ -21,6 +82,14 @@ endforeach()
|
||||
|
||||
include("${CMAKE_CURRENT_LIST_DIR}/@EXPORT_SET_NAME@.cmake")
|
||||
|
||||
foreach(component IN LISTS Void_FIND_COMPONENTS)
|
||||
if(TARGET Void::${component})
|
||||
set(Void_${component}_FOUND TRUE)
|
||||
else()
|
||||
set(Void_${component}_FOUND FALSE)
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
# Auto-load the testing helper so consumers get void_add_tests + the
|
||||
# auto-scan sweep just by find_package(Void).
|
||||
if(EXISTS "${CMAKE_CURRENT_LIST_DIR}/VoidTesting.cmake")
|
||||
|
||||
Reference in new issue
Block a user