Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add CMake exported targets #140

Merged
merged 1 commit into from
Oct 11, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions dynamicEDT3D/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,9 @@ set(DYNAMICEDT3D_INCLUDE_DIRS "${CMAKE_INSTALL_PREFIX}/include")
set(DYNAMICEDT3D_LIB_DIR "${CMAKE_INSTALL_PREFIX}/lib")
#set(DYNAMICEDT3D_CMAKE_DIR "${INSTALL_DATA_DIR}/FooBar/CMake")

set(DYNAMICEDT3D_INCLUDE_TARGETS
"include(\${CMAKE_CURRENT_LIST_DIR}/dynamicEDT3DTargets.cmake)")

CONFIGURE_PACKAGE_CONFIG_FILE(
dynamicEDT3DConfig.cmake.in
"${PROJECT_BINARY_DIR}/InstallFiles/dynamicEDT3DConfig.cmake"
Expand Down
2 changes: 2 additions & 0 deletions dynamicEDT3D/dynamicEDT3DConfig.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,5 @@ set_and_check(DYNAMICEDT3D_INCLUDE_DIRS "@PACKAGE_DYNAMICEDT3D_INCLUDE_DIRS@")
set_and_check(DYNAMICEDT3D_LIBRARY_DIRS "@PACKAGE_DYNAMICEDT3D_LIB_DIR@")

set(DYNAMICEDT3D_LIBRARIES "@PACKAGE_DYNAMICEDT3D_LIB_DIR@/@DYNAMICEDT3D_LIBRARY@")

@DYNAMICEDT3D_INCLUDE_TARGETS@
13 changes: 9 additions & 4 deletions dynamicEDT3D/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ target_link_libraries(dynamicedt3d-static ${OCTOMAP_LIBRARIES})

SET_TARGET_PROPERTIES(dynamicedt3d-static PROPERTIES OUTPUT_NAME "dynamicedt3d")

export(TARGETS dynamicedt3d dynamicedt3d-static
FILE "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/cmake/dynamicEDT3D/dynamicEDT3DTargets.cmake")

# directly depend on the octomap library target when building the
# complete distribution, so it it recompiled as needed
if (CMAKE_PROJECT_NAME STREQUAL "octomap-distribution")
Expand All @@ -23,7 +26,9 @@ endif()

ADD_SUBDIRECTORY(examples)

install(TARGETS
dynamicedt3d
dynamicedt3d-static
${INSTALL_TARGETS_DEFAULT_ARGS})
install(TARGETS dynamicedt3d dynamicedt3d-static
EXPORT dynamicEDT3DTargets
INCLUDES DESTINATION include
${INSTALL_TARGETS_DEFAULT_ARGS}
)
install(EXPORT dynamicEDT3DTargets DESTINATION share/dynamicEDT3D/)
3 changes: 3 additions & 0 deletions octomap/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,9 @@ set(OCTOMAP_INCLUDE_DIRS "${CMAKE_INSTALL_PREFIX}/include")
set(OCTOMAP_LIB_DIR "${CMAKE_INSTALL_PREFIX}/lib")
#set(OCTOMAP_CMAKE_DIR "${INSTALL_DATA_DIR}/FooBar/CMake")

set(OCTOMAP_INCLUDE_TARGETS
"include(\${CMAKE_CURRENT_LIST_DIR}/octomap-targets.cmake)")

CONFIGURE_PACKAGE_CONFIG_FILE(
octomap-config.cmake.in
"${PROJECT_BINARY_DIR}/InstallFiles/octomap-config.cmake"
Expand Down
2 changes: 2 additions & 0 deletions octomap/octomap-config.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,5 @@ set(OCTOMAP_LIBRARIES
"@PACKAGE_OCTOMAP_LIB_DIR@/@OCTOMAP_LIBRARY@"
"@PACKAGE_OCTOMAP_LIB_DIR@/@OCTOMATH_LIBRARY@"
)

@OCTOMAP_INCLUDE_TARGETS@
14 changes: 11 additions & 3 deletions octomap/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ SET_TARGET_PROPERTIES(octomap-static PROPERTIES OUTPUT_NAME "octomap")

TARGET_LINK_LIBRARIES(octomap octomath)

export(TARGETS octomap octomap-static
APPEND FILE "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/cmake/octomap/octomap-targets.cmake")

ADD_SUBDIRECTORY( testing )

ADD_EXECUTABLE(graph2tree graph2tree.cpp)
Expand Down Expand Up @@ -59,9 +62,14 @@ TARGET_LINK_LIBRARIES(intersection_example octomap)
ADD_EXECUTABLE(octree2pointcloud octree2pointcloud.cpp)
TARGET_LINK_LIBRARIES(octree2pointcloud octomap)

install(TARGETS
octomap
octomap-static
install(TARGETS octomap octomap-static
EXPORT octomap-targets
INCLUDES DESTINATION include
${INSTALL_TARGETS_DEFAULT_ARGS}
)
install(EXPORT octomap-targets DESTINATION share/octomap/)

install(TARGETS
graph2tree
log2graph
binvox2bt
Expand Down
10 changes: 8 additions & 2 deletions octomap/src/math/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,11 @@ SET_TARGET_PROPERTIES( octomath PROPERTIES
ADD_LIBRARY( octomath-static STATIC ${octomath_SRCS})
SET_TARGET_PROPERTIES(octomath-static PROPERTIES OUTPUT_NAME "octomath")

install(TARGETS octomath octomath-static ${INSTALL_TARGETS_DEFAULT_ARGS})

export(TARGETS octomath octomath-static
APPEND FILE "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/cmake/octomap/octomap-targets.cmake")

install(TARGETS octomath octomath-static
EXPORT octomap-targets
INCLUDES DESTINATION include
${INSTALL_TARGETS_DEFAULT_ARGS}
)
3 changes: 3 additions & 0 deletions octovis/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,9 @@ IF(BUILD_VIEWER)
set(OCTOVIS_LIB_DIR "${CMAKE_INSTALL_PREFIX}/lib")
#set(OCTOMAP_CMAKE_DIR "${INSTALL_DATA_DIR}/FooBar/CMake")

set(OCTOVIS_INCLUDE_TARGETS
"include(\${CMAKE_CURRENT_LIST_DIR}/octovis-targets.cmake)")

CONFIGURE_PACKAGE_CONFIG_FILE(
octovis-config.cmake.in
"${PROJECT_BINARY_DIR}/InstallFiles/octovis-config.cmake"
Expand Down
10 changes: 7 additions & 3 deletions octovis/CMakeLists_src.txt
Original file line number Diff line number Diff line change
Expand Up @@ -113,11 +113,15 @@ IF(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
)
ENDIF(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")

install(TARGETS octovis
octovis-static
octovis-shared
export(TARGETS octovis octovis-static octovis-shared
FILE "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/cmake/octovis/octovis-targets.cmake")

install(TARGETS octovis octovis-static octovis-shared
EXPORT octovis-targets
INCLUDES DESTINATION include
${INSTALL_TARGETS_DEFAULT_ARGS}
)
install(EXPORT octovis-targets DESTINATION share/octovis/)

file(GLOB octovis_HDRS ${PROJECT_SOURCE_DIR}/include/octovis/*.h)
# filter generated headers for GUI:
Expand Down
2 changes: 2 additions & 0 deletions octovis/octovis-config.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,5 @@ set(OCTOVIS_LIBRARIES
"@QT_LIBRARIES@"
"@PACKAGE_OCTOVIS_LIB_DIR@/@OCTOVIS_LIBRARY@"
)

@OCTOVIS_INCLUDE_TARGETS@