Skip to content

Commit e57b829

Browse files
committed
Add BUILD_STREAM_CONVERTOR to optionally avoid the yaml-cpp dependency
It is only needed by overlaybd-streamConv, which is not installed by CMake, and is presumably not essential. The dependency is fetched from git if it is not found system-wide, but it should be possible to perform an offline build. Signed-off-by: James Le Cuirot <jlecuirot@microsoft.com>
1 parent 222aa97 commit e57b829

2 files changed

Lines changed: 17 additions & 10 deletions

File tree

CMakeLists.txt

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -44,19 +44,23 @@ set(CMAKE_CXX_STANDARD_REQUIRED on)
4444
set(ENABLE_MIMIC_VDSO off)
4545

4646
option(BUILD_CURL_FROM_SOURCE "Compile static libcurl" off)
47+
option(BUILD_STREAM_CONVERTOR "Build the stream convertor" on)
4748
option(ORIGIN_EXT2FS "Use original libext2fs" off)
49+
4850
find_package(photon REQUIRED)
4951
find_package(tcmu REQUIRED)
50-
find_package(yaml-cpp)
51-
if (NOT yaml-cpp_FOUND)
52-
FetchContent_Declare(
53-
yaml-cpp
54-
GIT_REPOSITORY https://github.com/jbeder/yaml-cpp.git
55-
GIT_TAG 0.8.0
56-
)
57-
FetchContent_MakeAvailable(yaml-cpp)
58-
endif()
5952

53+
if(BUILD_STREAM_CONVERTOR)
54+
find_package(yaml-cpp)
55+
if (NOT yaml-cpp_FOUND)
56+
FetchContent_Declare(
57+
yaml-cpp
58+
GIT_REPOSITORY https://github.com/jbeder/yaml-cpp.git
59+
GIT_TAG 0.8.0
60+
)
61+
FetchContent_MakeAvailable(yaml-cpp)
62+
endif()
63+
endif()
6064

6165
if(BUILD_TESTING)
6266
enable_testing()

src/overlaybd/CMakeLists.txt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,10 @@ add_subdirectory(cache)
66
add_subdirectory(tar)
77
add_subdirectory(gzip)
88
add_subdirectory(gzindex)
9-
add_subdirectory(stream_convertor)
9+
10+
if(BUILD_STREAM_CONVERTOR)
11+
add_subdirectory(stream_convertor)
12+
endif()
1013

1114
add_library(overlaybd_lib INTERFACE)
1215
target_include_directories(overlaybd_lib INTERFACE

0 commit comments

Comments
 (0)