Skip to content

Commit 5384e9d

Browse files
remove submodules (replaced with FetchContent)
1 parent df6d0db commit 5384e9d

File tree

6 files changed

+38
-20
lines changed

6 files changed

+38
-20
lines changed

.gitmodules

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,3 @@
1-
[submodule "libs/cxxopts"]
2-
path = libs/cxxopts
3-
url = https://github.com/NikolasK-source/cxxopts.git
41
[submodule "libs/libmodbus"]
52
path = libs/libmodbus
63
url = https://github.com/stephane/libmodbus
7-
[submodule "libs/cxxshm"]
8-
path = libs/cxxshm
9-
url = https://github.com/NikolasK-source/cxxshm.git
10-
[submodule "libs/cxxsemaphore"]
11-
path = libs/cxxsemaphore
12-
url = https://github.com/NikolasK-source/cxxsemaphore.git

libs/CMakeLists.txt

Lines changed: 37 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,47 @@
22
# ---------------------------------------- subdirectories --------------------------------------------------------------
33
# ======================================================================================================================
44
include(../modbus.cmake)
5-
target_link_libraries(${Target} PRIVATE modbus)
5+
6+
7+
# ---------------------------------------- fetch content ---------------------------------------------------------------
8+
# ======================================================================================================================
9+
include(FetchContent)
10+
11+
# cxxopts (jarro2783)
12+
FetchContent_Declare(
13+
cxxopts
14+
GIT_REPOSITORY https://github.com/jarro2783/cxxopts.git
15+
GIT_TAG v3.2.0
16+
EXCLUDE_FROM_ALL
17+
)
18+
19+
set(CXXOPTS_STANDALONE_PROJECT ON CACHE BOOL "" FORCE)
20+
FetchContent_MakeAvailable(cxxopts)
21+
22+
# cxxshm
23+
FetchContent_Declare(
24+
cxxshm
25+
GIT_REPOSITORY https://github.com/NikolasK-source/cxxshm.git
26+
GIT_TAG v1.1.0
27+
EXCLUDE_FROM_ALL
28+
)
29+
30+
FetchContent_MakeAvailable(cxxshm)
31+
32+
# cxxsemaphore
33+
FetchContent_Declare(
34+
cxxsemaphore
35+
GIT_REPOSITORY https://github.com/NikolasK-source/cxxsemaphore.git
36+
GIT_TAG v1.0.1
37+
EXCLUDE_FROM_ALL
38+
)
39+
40+
FetchContent_MakeAvailable(cxxsemaphore)
641

742
# ---------------------------------------- link libraries --------------------------------------------------------------
843
# ======================================================================================================================
44+
target_link_libraries(${Target} PRIVATE modbus)
945
target_link_libraries(${Target} PRIVATE rt)
10-
11-
add_subdirectory(cxxopts EXCLUDE_FROM_ALL)
1246
target_link_libraries(${Target} PRIVATE cxxopts)
13-
14-
add_subdirectory(cxxshm EXCLUDE_FROM_ALL)
1547
target_link_libraries(${Target} PRIVATE cxxshm)
16-
17-
add_subdirectory(cxxsemaphore EXCLUDE_FROM_ALL)
1848
target_link_libraries(${Target} PRIVATE cxxsemaphore)

libs/cxxopts

Lines changed: 0 additions & 1 deletion
This file was deleted.

libs/cxxsemaphore

Lines changed: 0 additions & 1 deletion
This file was deleted.

libs/cxxshm

Lines changed: 0 additions & 1 deletion
This file was deleted.

src/main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ int main(int argc, char **argv) {
183183
cxxopts::ParseResult args;
184184
try {
185185
args = options.parse(argc, argv);
186-
} catch (cxxopts::OptionParseException &e) {
186+
} catch (cxxopts::exceptions::exception &e) {
187187
std::cerr << Print_Time::iso << " ERROR: Failed to parse arguments: " << e.what() << '.' << std::endl;
188188
return exit_usage();
189189
}

0 commit comments

Comments
 (0)