include(FetchContent) function(vbs_add_void_dependency) # Function scope keeps dependency policy out of the embedding project's variables/cache. set(VOID_ENABLE_TESTING OFF) set(VOID_ENABLE_BENCHMARKS OFF) set(BUILD_SHARED_LIBS OFF) set(VOID_FETCH_SQLITE3 OFF) set(VOID_ENABLED_MODULES Configuration Text Unicode Async Algorithms Crypto Archive) if(VBS_BUILD_TESTS) list(APPEND VOID_ENABLED_MODULES Testing) endif() # Crypto (VL-007) and Archive (VL-006) now work with zero external dependencies in VoidLibrary; # Sqlite remains opportunistic when system SQLite3 is installed. find_package(SQLite3 QUIET) if(SQLite3_FOUND) list(APPEND VOID_ENABLED_MODULES Sqlite) set(VBS_HAS_VOID_SQLITE ON PARENT_SCOPE) else() set(VBS_HAS_VOID_SQLITE OFF PARENT_SCOPE) endif() if(VBS_VOID_SOURCE_DIR) get_filename_component(_vbs_void_source "${VBS_VOID_SOURCE_DIR}" ABSOLUTE BASE_DIR "${CMAKE_CURRENT_SOURCE_DIR}") if(NOT IS_DIRECTORY "${_vbs_void_source}" OR NOT EXISTS "${_vbs_void_source}/CMakeLists.txt") message(FATAL_ERROR "VBS_VOID_SOURCE_DIR must contain a VoidLibrary CMakeLists.txt") endif() message(STATUS "VBS development source override: ${_vbs_void_source}; " "the pinned VoidLibrary revision ${VBS_VOID_REVISION} is bypassed") FetchContent_Declare(voidlibrary SOURCE_DIR "${_vbs_void_source}") else() FetchContent_Declare(voidlibrary GIT_REPOSITORY https://git.faumaray.com/Void/VoidLibrary.git GIT_TAG "${VBS_VOID_REVISION}" GIT_SHALLOW FALSE) endif() FetchContent_MakeAvailable(voidlibrary) set(VBS_VOID_TESTING_SCRIPT "${voidlibrary_SOURCE_DIR}/cmake/VoidTesting.cmake" PARENT_SCOPE) set(VBS_VOID_RESOLVED_SOURCE_DIR "${voidlibrary_SOURCE_DIR}" PARENT_SCOPE) endfunction()