Skip to content

Commit 81abd3c

Browse files
committed
Improve cmake files of the cli plugins.
1 parent 237bb5a commit 81abd3c

File tree

2 files changed

+31
-19
lines changed

2 files changed

+31
-19
lines changed

source/cli/plugins/CMakeLists.txt

Lines changed: 31 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,16 @@ if(NOT OPTION_BUILD_LOADERS OR NOT OPTION_BUILD_LOADERS_EXT OR NOT OPTION_BUILD_
33
return()
44
endif()
55

6-
# Extension sub-projects
7-
add_subdirectory(cli_repl_plugin)
8-
add_subdirectory(cli_cmd_plugin)
9-
add_subdirectory(cli_core_plugin)
10-
add_subdirectory(cli_sandbox_plugin)
6+
#
7+
# NodeJS Dependency
8+
#
9+
10+
find_package(NodeJS)
11+
12+
if(NOT NodeJS_FOUND)
13+
message(SEND_ERROR "NodeJS libraries not found")
14+
return()
15+
endif()
1116

1217
# Generate output directories for CLI plugins
1318
execute_process(
@@ -16,3 +21,24 @@ execute_process(
1621
COMMAND ${CMAKE_COMMAND} -E make_directory "${PROJECT_OUTPUT_DIR}/plugins/cli/repl"
1722
COMMAND ${CMAKE_COMMAND} -E make_directory "${PROJECT_OUTPUT_DIR}/plugins/cli/cmd"
1823
)
24+
25+
#
26+
# REPL Plugins
27+
#
28+
29+
add_subdirectory(cli_repl_plugin)
30+
add_subdirectory(cli_core_plugin)
31+
32+
#
33+
# CMD Plugins
34+
#
35+
36+
# NodeJS added util.parseArgs([config]) in versions v18.3.0, v16.17.0
37+
# Check for compatibility, otherwise use fallback command parser in the CLI
38+
if(NOT (NodeJS_VERSION VERSION_GREATER_EQUAL "18.3.0" OR (NodeJS_VERSION_MAJOR LESS 18 AND NodeJS_VERSION VERSION_GREATER_EQUAL "16.17.0")))
39+
message(WARNING "NodeJS version ${NodeJS_VERSION} does not support ${target}, at least v18.3.0 or v16.17.0 are required, using fallback command parser")
40+
return()
41+
endif()
42+
43+
add_subdirectory(cli_cmd_plugin)
44+
add_subdirectory(cli_sandbox_plugin)

source/cli/plugins/cli_cmd_plugin/CMakeLists.txt

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,6 @@ if(NOT OPTION_BUILD_LOADERS OR NOT OPTION_BUILD_LOADERS_EXT OR NOT OPTION_BUILD_
33
return()
44
endif()
55

6-
find_package(NodeJS)
7-
8-
if(NOT NodeJS_FOUND)
9-
message(SEND_ERROR "NodeJS libraries not found")
10-
return()
11-
endif()
12-
136
#
147
# Plugin name and options
158
#
@@ -20,13 +13,6 @@ set(target cli_cmd_plugin)
2013
# Exit here if required dependencies are not met
2114
message(STATUS "Plugin ${target}")
2215

23-
# NodeJS added util.parseArgs([config]) in versions v18.3.0, v16.17.0
24-
# Check for compatibility, otherwise use fallback command parser in the CLI
25-
if(NOT (NodeJS_VERSION VERSION_GREATER_EQUAL "18.3.0" OR (NodeJS_VERSION_MAJOR LESS 18 AND NodeJS_VERSION VERSION_GREATER_EQUAL "16.17.0")))
26-
message(WARNING "NodeJS version ${NodeJS_VERSION} does not support ${target}, at least v18.3.0 or v16.17.0 are required, using fallback command parser")
27-
return()
28-
endif()
29-
3016
#
3117
# Source
3218
#

0 commit comments

Comments
 (0)