@@ -42,9 +42,10 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON)
4242# --------------------------------------------------------------------
4343# Umbrella build policy:
4444# When building inside the Vix umbrella, dependencies are managed by the
45- # umbrella (add_subdirectory order + options). Log must not FetchContent
46- # nor add sibling subdirectories in umbrella mode.
45+ # umbrella. In that mode, log must not auto-fetch utils.
4746# --------------------------------------------------------------------
47+ option (VIX_LOG_FETCH_UTILS "Auto-fetch vix::utils if missing" ON )
48+
4849if (DEFINED VIX_UMBRELLA_BUILD AND VIX_UMBRELLA_BUILD)
4950 set (VIX_LOG_FETCH_UTILS OFF CACHE BOOL "Auto-fetch vix::utils if missing" FORCE )
5051endif ()
@@ -57,12 +58,24 @@ file(GLOB_RECURSE LOG_SOURCES CONFIGURE_DEPENDS
5758# Utils dependency
5859if (NOT TARGET vix::utils AND NOT TARGET vix_utils)
5960 if (EXISTS "${CMAKE_CURRENT_LIST_DIR} /../utils/CMakeLists.txt" )
60- message (STATUS "[log] Adding utils from umbrella : ../utils" )
61+ message (STATUS "[log] Adding utils from sibling : ../utils" )
6162 add_subdirectory ("${CMAKE_CURRENT_LIST_DIR} /../utils" "utils" )
62- elseif (VIX_LOG_FETCH_UTILS)
63+ endif ()
64+
65+ if (NOT TARGET vix::utils AND NOT TARGET vix_utils)
6366 find_package (vix_utils CONFIG QUIET )
6467 find_package (utils CONFIG QUIET )
6568 endif ()
69+
70+ if (NOT TARGET vix::utils AND NOT TARGET vix_utils AND VIX_LOG_FETCH_UTILS)
71+ include (FetchContent )
72+ message (STATUS "[log] Fetching vix::utils via FetchContent" )
73+ FetchContent_Declare (vix_utils
74+ GIT_REPOSITORY https://github.com/vixcpp/utils.git
75+ GIT_TAG v0.1.0
76+ )
77+ FetchContent_MakeAvailable (vix_utils)
78+ endif ()
6679endif ()
6780
6881set (VIX_UTILS_TARGET "" )
0 commit comments