File tree Expand file tree Collapse file tree 9 files changed +82
-36
lines changed
inline_parser/src/inline_parser Expand file tree Collapse file tree 9 files changed +82
-36
lines changed Original file line number Diff line number Diff line change 1
- option (NUI_FETCH_FMT "Fetch fmt" ON )
1
+ option (NUI_FIND_FMT "Find fmt first before fetch content" ON )
2
+ option (NUI_FETCH_FMT "Try FetchContent for fmt" ON )
2
3
set (NUI_FMT_GIT_REPOSITORY "https://github.com/fmtlib/fmt.git" CACHE STRING "fmt git repository" )
3
- set (NUI_FMT_GIT_TAG "4e8640ed90ac8751d4a8ca500b893cc8c4bb9668 " CACHE STRING "fmt git tag" )
4
+ set (NUI_FMT_GIT_TAG "7a8b54a0ef7ca1791b0a5491b6e0593e1cf2dd5e " CACHE STRING "fmt git tag" )
4
5
5
- if (NUI_FETCH_FMT)
6
- include (FetchContent)
7
- FetchContent_Declare(
8
- fmt
9
- GIT_REPOSITORY ${NUI_FMT_GIT_REPOSITORY}
10
- GIT_TAG ${NUI_FMT_GIT_TAG}
11
- )
6
+ include ("${CMAKE_CURRENT_LIST_DIR} /../fetcher.cmake" )
12
7
13
- FetchContent_MakeAvailable(fmt)
14
- endif ()
8
+ nui_fetch_dependency(
9
+ LIBRARY_NAME fmt
10
+ FIND ${NUI_FIND_FMT}
11
+ FETCH ${NUI_FETCH_FMT}
12
+ GIT_REPOSITORY ${NUI_FMT_GIT_REPOSITORY}
13
+ GIT_TAG ${NUI_FMT_GIT_TAG}
14
+ )
Original file line number Diff line number Diff line change
1
+ option (NUI_FIND_GTEST "Find gtest" ON )
1
2
option (NUI_FETCH_GTEST "Fetch gtest" ON )
2
3
set (NUI_GTEST_GIT_REPOSITORY "https://github.com/google/googletest.git" CACHE STRING "gtest git repository" )
3
4
set (NUI_GTEST_GIT_TAG "beb552fb47e9e8a6ddab20526663c2dddd601ec6" CACHE STRING "gtest git tag" )
4
5
5
- if (NUI_FETCH_GTEST)
6
- include (FetchContent)
7
- FetchContent_Declare(
8
- gtest
9
- GIT_REPOSITORY ${NUI_GTEST_GIT_REPOSITORY}
10
- GIT_TAG ${NUI_GTEST_GIT_TAG}
11
- )
6
+ include ("${CMAKE_CURRENT_LIST_DIR} /../fetcher.cmake" )
12
7
13
- FetchContent_MakeAvailable(gtest)
14
- endif ()
8
+ nui_fetch_dependency(
9
+ LIBRARY_NAME GTest
10
+ FIND ${NUI_FIND_GTEST}
11
+ FETCH ${NUI_FETCH_GTEST}
12
+ GIT_REPOSITORY ${NUI_GTEST_GIT_REPOSITORY}
13
+ GIT_TAG ${NUI_GTEST_GIT_TAG}
14
+ )
Original file line number Diff line number Diff line change 1
- option (NUI_FETCH_NLOHMANN_JSON "Fetch nlohmann_json" ON )
1
+ option (NUI_FIND_NLOHMANN_JSON "Try find_package to find nlohmann_json" ON )
2
+ option (NUI_FETCH_NLOHMANN_JSON "Try fetch nlohmann json" ON )
2
3
set (NUI_NLOHMANN_JSON_GIT_REPOSITORY "https://github.com/nlohmann/json.git" CACHE STRING "nlohmann_json git repository" )
3
4
set (NUI_NLOHMANN_JSON_GIT_TAG "8c391e04fe4195d8be862c97f38cfe10e2a3472e" CACHE STRING "nlohmann_json git tag" )
4
5
5
- if (NUI_FETCH_NLOHMANN_JSON)
6
- include (FetchContent)
7
- FetchContent_Declare(
8
- nlohmann_json
9
- GIT_REPOSITORY ${NUI_NLOHMANN_JSON_GIT_REPOSITORY}
10
- GIT_TAG ${NUI_NLOHMANN_JSON_GIT_TAG}
11
- )
6
+ include ("${CMAKE_CURRENT_LIST_DIR} /../fetcher.cmake" )
12
7
13
- FetchContent_MakeAvailable(nlohmann_json)
14
- endif ()
8
+ nui_fetch_dependency(
9
+ LIBRARY_NAME nlohmann_json
10
+ FIND ${NUI_FIND_NLOHMANN_JSON}
11
+ FETCH ${NUI_FETCH_NLOHMANN_JSON}
12
+ GIT_REPOSITORY ${NUI_NLOHMANN_JSON_GIT_REPOSITORY}
13
+ GIT_TAG ${NUI_NLOHMANN_JSON_GIT_TAG}
14
+ )
Original file line number Diff line number Diff line change 1
1
option (NUI_FETCH_ROAR "Fetch roar" ON )
2
2
set (NUI_ROAR_REPOSITORY "https://github.com/5cript/roar.git" CACHE STRING "roar repository" )
3
- set (NUI_ROAR_TAG "45230b49703e8bb29cecb07c65927eb905b7c7fe " CACHE STRING "roar tag" )
3
+ set (NUI_ROAR_TAG "f2f03784a77e03f83b6de3120a3c54cbc427b46e " CACHE STRING "roar tag" )
4
4
5
5
if (NUI_FETCH_ROAR)
6
6
include (FetchContent)
Original file line number Diff line number Diff line change
1
+ include (FetchContent)
2
+
3
+ function (nui_fetch_dependency)
4
+ cmake_parse_arguments (
5
+ NUI_FETCH_ARGS
6
+ "FIND;FETCH"
7
+ "LIBRARY_NAME;PACKAGE_NAME;FETCH_NAME;GIT_REPOSITORY;GIT_TAG"
8
+ ""
9
+ ${ARGN}
10
+ )
11
+
12
+ if (NOT NUI_FETCH_ARGS_PACKAGE_NAME)
13
+ if (NOT NUI_FETCH_ARGS_LIBRARY_NAME)
14
+ message (FATAL_ERROR "NUI_FETCH_ARGS_PACKAGE_NAME is not set" )
15
+ endif ()
16
+ set (NUI_FETCH_ARGS_PACKAGE_NAME ${NUI_FETCH_ARGS_LIBRARY_NAME} )
17
+ endif ()
18
+ if (NOT NUI_FETCH_ARGS_FETCH_NAME)
19
+ if (NOT NUI_FETCH_ARGS_LIBRARY_NAME)
20
+ message (FATAL_ERROR "NUI_FETCH_ARGS_FETCH_NAME is not set" )
21
+ endif ()
22
+ set (NUI_FETCH_ARGS_FETCH_NAME ${NUI_FETCH_ARGS_LIBRARY_NAME} )
23
+ endif ()
24
+
25
+ if (NUI_FETCH_ARGS_FIND)
26
+ find_package (${NUI_FETCH_ARGS_PACKAGE_NAME} QUIET )
27
+
28
+ if (${NUI_FETCH_ARGS_PACKAGE_NAME} _FOUND)
29
+ return ()
30
+ endif ()
31
+ endif ()
32
+
33
+ if (NUI_FETCH_ARGS_FETCH AND ${NUI_FETCH_ARGS_FETCH} )
34
+ message (STATUS "Fetching ${NUI_FETCH_ARGS_FETCH_NAME} " )
35
+ FetchContent_Declare(
36
+ ${NUI_FETCH_ARGS_FETCH_NAME}
37
+ GIT_REPOSITORY ${NUI_FETCH_ARGS_GIT_REPOSITORY}
38
+ GIT_TAG ${NUI_FETCH_ARGS_GIT_TAG}
39
+ )
40
+ FetchContent_MakeAvailable(${NUI_FETCH_ARGS_FETCH_NAME} )
41
+ endif ()
42
+ endfunction ()
Original file line number Diff line number Diff line change @@ -3,7 +3,7 @@ function(nui_prepare_emscripten_target)
3
3
NUI_PREPARE_EMSCRIPTEN_TARGET_ARGS
4
4
"NO_INLINE;NO_INLINE_INJECT"
5
5
"TARGET;PREJS;STATIC;UNPACKED_MODE"
6
- "EMSCRIPTEN_LINK_OPTIONS;EMSCRIPTEN_COMPILE_OPTIONS;PARCEL_ARGS"
6
+ "EMSCRIPTEN_LINK_OPTIONS;EMSCRIPTEN_COMPILE_OPTIONS;PARCEL_ARGS;NPM_INSTALL_ARGS "
7
7
${ARGN}
8
8
)
9
9
@@ -28,7 +28,7 @@ function(nui_prepare_emscripten_target)
28
28
29
29
add_custom_target (
30
30
${NUI_PREPARE_EMSCRIPTEN_TARGET_ARGS_TARGET} -npm-install
31
- COMMAND ${NUI_NPM} install
31
+ COMMAND ${NUI_NPM} install ${NUI_PREPARE_EMSCRIPTEN_TARGET_ARGS_NPM_INSTALL_ARGS}
32
32
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
33
33
)
34
34
Original file line number Diff line number Diff line change @@ -33,7 +33,7 @@ target_link_libraries(
33
33
fmt
34
34
webview-iface
35
35
portable_file_dialogs
36
- nlohmann_json
36
+ nlohmann_json::nlohmann_json
37
37
roar
38
38
Boost::boost
39
39
)
Original file line number Diff line number Diff line change @@ -2,12 +2,14 @@ cmake_minimum_required(VERSION 3.16)
2
2
3
3
project (inline-parser VERSION 0.1.0)
4
4
5
+ include ("${CMAKE_CURRENT_LIST_DIR} /../../../../cmake/dependencies/nlohmann_json.cmake" )
6
+
5
7
add_library (inline-parser-lib
6
8
STATIC
7
9
inline_extractor.cpp
8
10
section_cache.cpp
9
11
)
10
- target_link_libraries (inline-parser-lib PUBLIC nlohmann_json roar)
12
+ target_link_libraries (inline-parser-lib PUBLIC nlohmann_json::nlohmann_json roar)
11
13
target_compile_features (inline-parser-lib PUBLIC cxx_std_20)
12
14
target_include_directories (inline-parser-lib PUBLIC ${CMAKE_CURRENT_LIST_DIR} /../../include )
13
15
Original file line number Diff line number Diff line change @@ -2,8 +2,10 @@ cmake_minimum_required(VERSION 3.16)
2
2
3
3
project (parcel-adapter VERSION 0.1.0)
4
4
5
+ include ("${CMAKE_CURRENT_LIST_DIR} /../../cmake/dependencies/nlohmann_json.cmake" )
6
+
5
7
add_executable (parcel-adapter main.cpp)
6
- target_link_libraries (parcel-adapter PRIVATE nlohmann_json)
8
+ target_link_libraries (parcel-adapter PRIVATE nlohmann_json::nlohmann_json )
7
9
target_compile_features (parcel-adapter PRIVATE cxx_std_20)
8
10
9
11
set_target_properties (parcel-adapter
You can’t perform that action at this time.
0 commit comments