Skip to content

Commit 3931a35

Browse files
authored
nlohamm-fix (#100)
1 parent 001cbb0 commit 3931a35

File tree

2 files changed

+46
-41
lines changed

2 files changed

+46
-41
lines changed

exporters/fluentd/CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,9 @@ if(nlohmann_json_FOUND)
3737
else()
3838
include(cmake/nlohmann-json.cmake)
3939
set(nlohmann_json_clone TRUE)
40+
set(nlohmann_json_SOURCE_DIR
41+
"${CMAKE_SOURCE_DIR}/nlohmann_json/single_include")
42+
include_directories(${nlohmann_json_SOURCE_DIR})
4043
message("\nnlohmann_json package was not found. Cloning from github")
4144
endif()
4245

Lines changed: 43 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,43 @@
1-
if("${nlohmann-json}" STREQUAL "")
2-
set(nlohmann-json "v3.9.1")
3-
endif()
4-
include(ExternalProject)
5-
ExternalProject_Add(nlohmann_json_download
6-
GIT_REPOSITORY https://github.com/nlohmann/json.git
7-
GIT_TAG
8-
"${nlohmann-json}"
9-
UPDATE_COMMAND ""
10-
CMAKE_ARGS
11-
-DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX}
12-
-DJSON_BuildTests=OFF
13-
-DJSON_Install=ON
14-
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
15-
TEST_AFTER_INSTALL
16-
0
17-
DOWNLOAD_NO_PROGRESS
18-
1
19-
LOG_CONFIGURE
20-
1
21-
LOG_BUILD
22-
1
23-
LOG_INSTALL
24-
1
25-
)
26-
27-
ExternalProject_Get_Property(nlohmann_json_download INSTALL_DIR)
28-
SET(NLOHMANN_JSON_INCLUDE_DIR ${INSTALL_DIR}/third_party/src/nlohmann_json_download/single_include)
29-
add_library(nlohmann_json_ INTERFACE)
30-
target_include_directories(nlohmann_json_ INTERFACE
31-
"$<BUILD_INTERFACE:${NLOHMANN_JSON_INCLUDE_DIR}>"
32-
"$<INSTALL_INTERFACE:include>")
33-
add_dependencies(nlohmann_json_ nlohmann_json_download)
34-
add_library(nlohmann_json::nlohmann_json ALIAS nlohmann_json_)
35-
36-
install(
37-
TARGETS nlohmann_json_
38-
EXPORT "${PROJECT_NAME}-target"
39-
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
40-
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
41-
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
1+
if("${nlohmann-json}" STREQUAL "")
2+
set(nlohmann-json "v3.9.1")
3+
endif()
4+
include(ExternalProject)
5+
ExternalProject_Add(nlohmann_json_download
6+
PREFIX nlohmann_json
7+
GIT_REPOSITORY https://github.com/nlohmann/json.git
8+
GIT_TAG
9+
"${nlohmann-json}"
10+
GIT_SHALLOW 1
11+
UPDATE_COMMAND ""
12+
CMAKE_ARGS
13+
-DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX}
14+
-DJSON_BuildTests=OFF
15+
-DJSON_Install=ON
16+
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
17+
TEST_AFTER_INSTALL
18+
0
19+
DOWNLOAD_NO_PROGRESS
20+
1
21+
LOG_CONFIGURE
22+
1
23+
LOG_BUILD
24+
1
25+
LOG_INSTALL
26+
1
27+
)
28+
29+
ExternalProject_Get_Property(nlohmann_json_download INSTALL_DIR)
30+
SET(NLOHMANN_JSON_INCLUDE_DIR ${INSTALL_DIR}/nlohmann_json/src/nlohmann_json_download/single_include)
31+
add_library(nlohmann_json_ INTERFACE)
32+
target_include_directories(nlohmann_json_ INTERFACE
33+
"$<BUILD_INTERFACE:${NLOHMANN_JSON_INCLUDE_DIR}>"
34+
"$<INSTALL_INTERFACE:include>")
35+
add_dependencies(nlohmann_json_ nlohmann_json_download)
36+
add_library(nlohmann_json::nlohmann_json ALIAS nlohmann_json_)
37+
38+
install(
39+
TARGETS nlohmann_json_
40+
EXPORT "${PROJECT_NAME}-target"
41+
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
42+
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
43+
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})

0 commit comments

Comments
 (0)