Skip to content

Commit 9c0875c

Browse files
authored
enable building a static library (#163)
Signed-off-by: Dirk Thomas <[email protected]>
1 parent dfab32e commit 9c0875c

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

CMakeLists.txt

+5-1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@ set(CLASS_LOADER_IGNORE_AMENT FALSE CACHE BOOL
1414
"Do not use ament when building this package.")
1515
if(NOT CLASS_LOADER_IGNORE_AMENT)
1616
find_package(ament_cmake)
17+
find_package(ament_cmake_ros REQUIRED)
18+
set(explicit_library_type "")
19+
else()
20+
set(explicit_library_type "SHARED")
1721
endif()
1822

1923
find_package(console_bridge_vendor REQUIRED) # Provides console_bridge 0.4.0 on platforms without it.
@@ -33,7 +37,7 @@ set(${PROJECT_NAME}_SRCS
3337
src/meta_object.cpp
3438
src/multi_library_class_loader.cpp
3539
)
36-
add_library(${PROJECT_NAME} SHARED ${${PROJECT_NAME}_SRCS})
40+
add_library(${PROJECT_NAME} ${explicit_library_type} ${${PROJECT_NAME}_SRCS})
3741
target_include_directories(${PROJECT_NAME} PUBLIC
3842
"$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>"
3943
"$<INSTALL_INTERFACE:include>")

package.xml

+1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
<build_depend>libconsole-bridge-dev</build_depend>
1818

1919
<buildtool_depend>ament_cmake</buildtool_depend>
20+
<buildtool_depend>ament_cmake_ros</buildtool_depend>
2021

2122
<exec_depend>console_bridge_vendor</exec_depend>
2223
<exec_depend>libconsole-bridge-dev</exec_depend>

0 commit comments

Comments
 (0)