Skip to content

Commit

Permalink
export modern CMake interface target
Browse files Browse the repository at this point in the history
Signed-off-by: Dirk Thomas <[email protected]>
  • Loading branch information
dirk-thomas committed Apr 30, 2020
1 parent e31d66e commit c4ed36e
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
11 changes: 11 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,17 @@ if (NOT MSVC)
install(FILES "${CMAKE_BINARY_DIR}/${pkg_conf_file}" DESTINATION lib/pkgconfig/ COMPONENT pkgconfig)
endif()

add_library(${PROJECT_NAME} INTERFACE)
target_include_directories(${PROJECT_NAME} INTERFACE
"$<INSTALL_INTERFACE:include>")
install(TARGETS ${PROJECT_NAME} EXPORT ${PROJECT_NAME})
install(
EXPORT ${PROJECT_NAME}
DESTINATION ${CMAKE_CONFIG_INSTALL_DIR}
NAMESPACE "${PROJECT_NAME}::"
FILE "${PROJECT_NAME}Export.cmake"
)

# Add uninstall target
# Ref: http://www.cmake.org/Wiki/CMake_FAQ#Can_I_do_.22make_uninstall.22_with_CMake.3F
configure_file("${PROJECT_SOURCE_DIR}/cmake/uninstall.cmake.in" "${PROJECT_BINARY_DIR}/uninstall.cmake" IMMEDIATE @ONLY)
Expand Down
2 changes: 2 additions & 0 deletions cmake/urdfdom_headers-config.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,5 @@ endif()
set(@PACKAGE_NAME@_CONFIG_INCLUDED TRUE)

set(@PACKAGE_NAME@_INCLUDE_DIRS "${@PROJECT_NAME@_DIR}/@RELATIVE_PATH_CMAKE_DIR_TO_PREFIX@/include")

include("${@PROJECT_NAME@_DIR}/@[email protected]")

0 comments on commit c4ed36e

Please sign in to comment.