Skip to content

Commit 8093d5b

Browse files
authored
Install headers to include/${PROJECT_NAME} (#354)
Signed-off-by: Shane Loretz <sloretz@osrfoundation.org>
1 parent 755f566 commit 8093d5b

File tree

2 files changed

+17
-13
lines changed

2 files changed

+17
-13
lines changed

pcl_conversions/CMakeLists.txt

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ include_directories(
3333
${PCL_COMMON_INCLUDE_DIRS}
3434
)
3535

36-
install(DIRECTORY include/${PROJECT_NAME}/
37-
DESTINATION include/${PROJECT_NAME}/
36+
install(DIRECTORY include/
37+
DESTINATION include/${PROJECT_NAME}
3838
)
3939

4040
# Add gtest based cpp test target
@@ -48,6 +48,8 @@ if(BUILD_TESTING)
4848
target_link_libraries(${PROJECT_NAME}-test ${Boost_LIBRARIES} ${PCL_LIBRARIES})
4949
endif()
5050

51-
ament_export_include_directories(include)
51+
# Export old-style CMake variables
52+
ament_export_include_directories("include/${PROJECT_NAME}")
53+
5254
ament_export_dependencies(${dependencies})
5355
ament_package()

pcl_ros/CMakeLists.txt

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -34,17 +34,15 @@ set(dependencies
3434
PCL
3535
)
3636

37-
include_directories(
38-
include
39-
${PCL_INCLUDE_DIRS}
40-
)
41-
4237
## Declare the pcl_ros_tf library
4338
add_library(pcl_ros_tf src/transforms.cpp)
39+
target_include_directories(pcl_ros_tf PUBLIC
40+
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
41+
$<INSTALL_INTERFACE:include/${PROJECT_NAME}>
42+
)
4443
ament_target_dependencies(pcl_ros_tf
4544
${dependencies}
4645
)
47-
target_link_libraries(pcl_ros_tf ${PCL_LIBRARIES})
4846

4947
### Nodelets
5048
#
@@ -165,7 +163,7 @@ endif()
165163

166164
install(
167165
DIRECTORY include/
168-
DESTINATION include
166+
DESTINATION include/${PROJECT_NAME}
169167
)
170168

171169
install(
@@ -185,14 +183,18 @@ install(
185183
RUNTIME DESTINATION bin
186184
ARCHIVE DESTINATION lib
187185
LIBRARY DESTINATION lib
188-
INCLUDES DESTINATION include
189186
)
190187

191188
install(DIRECTORY plugins samples
192189
DESTINATION share/${PROJECT_NAME})
193190

194-
ament_export_include_directories(include)
191+
# Export old-style CMake variables
192+
ament_export_include_directories("include/${PROJECT_NAME}")
195193
ament_export_libraries(pcl_ros_tf)
196-
ament_export_dependencies(${dependencies})
194+
195+
# Export modern CMake targets
197196
ament_export_targets(export_pcl_ros HAS_LIBRARY_TARGET)
197+
198+
ament_export_dependencies(${dependencies})
199+
198200
ament_package()

0 commit comments

Comments
 (0)