Skip to content

Commit

Permalink
add scope_guard library as a submodule
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
captain-yoshi committed Jul 17, 2024
1 parent 445aa0d commit f819a1f
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 1 deletion.
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,6 @@
url = https://github.com/pybind/pybind11
branch = smart_holder
shallow = true
[submodule "scope_guard"]
path = core/scope_guard/scope_guard
url = https://github.com/ricab/scope_guard
1 change: 1 addition & 0 deletions core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ add_compile_options(-fvisibility-inlines-hidden)

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

add_subdirectory(scope_guard)
add_subdirectory(src)
add_subdirectory(python)
add_subdirectory(test)
Expand Down
16 changes: 16 additions & 0 deletions core/scope_guard/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
cmake_minimum_required(VERSION 3.11) # for FetchContent
project(scope_guard)

# handle inclusions and dependencies
include(CheckCXXSymbolExists)
include(CheckCXXCompilerFlag)
include(GNUInstallDirs)


add_library(scope_guard INTERFACE)
add_library(scope_guard::scope_guard ALIAS scope_guard) # for consumption via add_subdirectory()

target_include_directories(scope_guard
INTERFACE
include # assuming we move the header file to an `include` directory
)
1 change: 1 addition & 0 deletions core/scope_guard/include/scope_guard/scope_guard.hpp
1 change: 1 addition & 0 deletions core/scope_guard/scope_guard
Submodule scope_guard added at 71a045
2 changes: 1 addition & 1 deletion core/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ add_library(${PROJECT_NAME}
solvers/pipeline_planner.cpp
solvers/multi_planner.cpp
)
target_link_libraries(${PROJECT_NAME} ${catkin_LIBRARIES} fmt::fmt)
target_link_libraries(${PROJECT_NAME} ${catkin_LIBRARIES} fmt::fmt scope_guard::scope_guard)
target_include_directories(${PROJECT_NAME}
PUBLIC $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>
PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
Expand Down

0 comments on commit f819a1f

Please sign in to comment.