Skip to content

Commit f819a1f

Browse files
committed
add scope_guard library as a submodule
A custom CMakeLists.txt is used to create the scope_guard libray. The original cmake libray file is only used to setup tests. See ricab/scope_guard#3.
1 parent 445aa0d commit f819a1f

File tree

6 files changed

+23
-1
lines changed

6 files changed

+23
-1
lines changed

.gitmodules

+3
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,6 @@
33
url = https://github.com/pybind/pybind11
44
branch = smart_holder
55
shallow = true
6+
[submodule "scope_guard"]
7+
path = core/scope_guard/scope_guard
8+
url = https://github.com/ricab/scope_guard

core/CMakeLists.txt

+1
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ add_compile_options(-fvisibility-inlines-hidden)
4242

4343
set(PROJECT_INCLUDE ${CMAKE_CURRENT_SOURCE_DIR}/include/moveit/task_constructor)
4444

45+
add_subdirectory(scope_guard)
4546
add_subdirectory(src)
4647
add_subdirectory(python)
4748
add_subdirectory(test)

core/scope_guard/CMakeLists.txt

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
cmake_minimum_required(VERSION 3.11) # for FetchContent
2+
project(scope_guard)
3+
4+
# handle inclusions and dependencies
5+
include(CheckCXXSymbolExists)
6+
include(CheckCXXCompilerFlag)
7+
include(GNUInstallDirs)
8+
9+
10+
add_library(scope_guard INTERFACE)
11+
add_library(scope_guard::scope_guard ALIAS scope_guard) # for consumption via add_subdirectory()
12+
13+
target_include_directories(scope_guard
14+
INTERFACE
15+
include # assuming we move the header file to an `include` directory
16+
)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../scope_guard/scope_guard.hpp

core/scope_guard/scope_guard

Submodule scope_guard added at 71a0452

core/src/CMakeLists.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ add_library(${PROJECT_NAME}
3737
solvers/pipeline_planner.cpp
3838
solvers/multi_planner.cpp
3939
)
40-
target_link_libraries(${PROJECT_NAME} ${catkin_LIBRARIES} fmt::fmt)
40+
target_link_libraries(${PROJECT_NAME} ${catkin_LIBRARIES} fmt::fmt scope_guard::scope_guard)
4141
target_include_directories(${PROJECT_NAME}
4242
PUBLIC $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>
4343
PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>

0 commit comments

Comments
 (0)