Skip to content

Commit dae8209

Browse files
authored
Add sparrow-json-reader (#36)
1 parent fbdc234 commit dae8209

File tree

2 files changed

+31
-16
lines changed

2 files changed

+31
-16
lines changed

cmake/external_dependencies.cmake

Lines changed: 29 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -26,21 +26,32 @@ function(find_package_or_fetch)
2626
find_package(${actual_pkg_name} ${FIND_PACKAGE_OPTIONS})
2727
endif()
2828

29-
if(FETCH_DEPENDENCIES_WITH_CMAKE STREQUAL "ON" OR FETCH_DEPENDENCIES_WITH_CMAKE STREQUAL "MISSING")
30-
if(NOT ${actual_pkg_name}_FOUND)
31-
message(STATUS "📦 Fetching ${arg_PACKAGE_NAME}")
32-
FetchContent_Declare(
33-
${arg_PACKAGE_NAME}
34-
GIT_SHALLOW TRUE
35-
GIT_REPOSITORY ${arg_GIT_REPOSITORY}
36-
GIT_TAG ${arg_TAG}
37-
GIT_PROGRESS TRUE
38-
SYSTEM
39-
EXCLUDE_FROM_ALL)
40-
FetchContent_MakeAvailable(${arg_PACKAGE_NAME})
41-
message(STATUS "\t✅ Fetched ${arg_PACKAGE_NAME}")
42-
else()
29+
if(arg_GIT_REPOSITORY)
30+
if(FETCH_DEPENDENCIES_WITH_CMAKE STREQUAL "ON" OR FETCH_DEPENDENCIES_WITH_CMAKE STREQUAL "MISSING")
31+
if(NOT ${actual_pkg_name}_FOUND)
32+
message(STATUS "📦 Fetching ${arg_PACKAGE_NAME}")
33+
FetchContent_Declare(
34+
${arg_PACKAGE_NAME}
35+
GIT_SHALLOW TRUE
36+
GIT_REPOSITORY ${arg_GIT_REPOSITORY}
37+
GIT_TAG ${arg_TAG}
38+
GIT_PROGRESS TRUE
39+
SYSTEM
40+
EXCLUDE_FROM_ALL)
41+
FetchContent_MakeAvailable(${arg_PACKAGE_NAME})
42+
message(STATUS "\t✅ Fetched ${arg_PACKAGE_NAME}")
43+
else()
44+
message(STATUS "📦 ${actual_pkg_name} found here: ${${actual_pkg_name}_DIR}")
45+
endif()
46+
endif()
47+
else()
48+
# No GIT_REPOSITORY provided - only find_package is attempted
49+
if(${actual_pkg_name}_FOUND)
4350
message(STATUS "📦 ${actual_pkg_name} found here: ${${actual_pkg_name}_DIR}")
51+
elseif(FETCH_DEPENDENCIES_WITH_CMAKE STREQUAL "OFF")
52+
message(FATAL_ERROR "Could not find ${actual_pkg_name} and no GIT_REPOSITORY provided for fetching")
53+
else()
54+
message(WARNING "Could not find ${actual_pkg_name} and no GIT_REPOSITORY provided for fetching")
4455
endif()
4556
endif()
4657
endfunction()
@@ -52,14 +63,17 @@ endif()
5263
find_package_or_fetch(
5364
PACKAGE_NAME sparrow
5465
GIT_REPOSITORY https://github.com/man-group/sparrow.git
55-
TAG 1.2.0
66+
TAG 1.3.0
5667
)
5768
unset(CREATE_JSON_READER_TARGET)
5869

5970
if(NOT TARGET sparrow::sparrow)
6071
add_library(sparrow::sparrow ALIAS sparrow)
6172
endif()
6273
if(${SPARROW_IPC_BUILD_TESTS})
74+
find_package_or_fetch(
75+
PACKAGE_NAME sparrow-json-reader
76+
)
6377
if(NOT TARGET sparrow::json_reader)
6478
add_library(sparrow::json_reader ALIAS json_reader)
6579
endif()

environment-dev.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ dependencies:
99
# Libraries dependencies
1010
- flatbuffers
1111
- nlohmann_json
12-
- sparrow-devel >=1.1.2
12+
- sparrow-devel
13+
- sparrow-json-reader
1314
- doctest
1415
# Documentation dependencies
1516
- doxygen

0 commit comments

Comments
 (0)