Skip to content

Commit 392385b

Browse files
committed
bindings/cpp: Use FetchContent for msgpack
1 parent b997d37 commit 392385b

1 file changed

Lines changed: 11 additions & 37 deletions

File tree

‎bindings/cpp/CMakeLists.txt‎

Lines changed: 11 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -52,54 +52,28 @@ find_package(Boost
5252
COMPONENTS context filesystem
5353
)
5454

55-
FetchContent_Declare(
56-
Corrosion
57-
GIT_REPOSITORY https://github.com/corrosion-rs/corrosion.git
58-
GIT_TAG v0.5.2
59-
)
6055

6156
###########################################################
6257
# msgpack - for serializing messages between C++ and Rust
6358
###########################################################
6459

65-
file(WRITE ${CMAKE_BINARY_DIR}/msgpack/download/CMakeLists.txt
66-
"cmake_minimum_required(VERSION 3.10)\n"
67-
"project(msgpack-download NONE)\n"
68-
""
69-
"include(ExternalProject)\n"
70-
"externalproject_add(msgpack\n"
71-
" GIT_REPOSITORY https://github.com/msgpack/msgpack-c\n"
72-
" # Use commit from the `cpp_master` which contains the msgpack-cxx C++ version\n"
73-
" GIT_TAG 092bc69b6e815980bce7808595c914dd3a29f905\n"
74-
" SOURCE_DIR ${CMAKE_BINARY_DIR}/msgpack/src\n"
75-
" BINARY_DIR ${CMAKE_BINARY_DIR}/msgpack/build\n"
76-
" # No building, that's done outside of this externalproject_add\n"
77-
" CONFIGURE_COMMAND \"\"\n"
78-
" BUILD_COMMAND \"\"\n"
79-
" INSTALL_COMMAND \"\"\n"
80-
" TEST_COMMAND \"\"\n"
81-
")"
82-
)
83-
84-
# Configure
85-
execute_process(
86-
COMMAND "${CMAKE_COMMAND}" -G "${CMAKE_GENERATOR}" .
87-
WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/msgpack/download"
88-
)
89-
90-
# Build
91-
execute_process(
92-
COMMAND "${CMAKE_COMMAND}" --build .
93-
WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/msgpack/download"
60+
FetchContent_Declare(
61+
msgpack
62+
GIT_REPOSITORY "https://github.com/msgpack/msgpack-c"
63+
# Use commit from the `cpp_master` which contains the msgpack-cxx C++ version
64+
GIT_TAG "092bc69b6e815980bce7808595c914dd3a29f905"
9465
)
95-
96-
# Import targets
97-
add_subdirectory("${CMAKE_BINARY_DIR}/msgpack/src" "msgpack" EXCLUDE_FROM_ALL)
66+
FetchContent_MakeAvailable(msgpack)
9867

9968
###########################################################
10069
# Ouisync Rust code
10170
###########################################################
10271

72+
FetchContent_Declare(
73+
Corrosion
74+
GIT_REPOSITORY https://github.com/corrosion-rs/corrosion.git
75+
GIT_TAG v0.5.2
76+
)
10377
FetchContent_MakeAvailable(Corrosion)
10478

10579
# CMAKE_CURRENT_SOURCE_DIR points to the dir path of this CMakeLists.txt file

0 commit comments

Comments
 (0)