Skip to content

Commit

Permalink
Export modern CMake interface target (orocos#366)
Browse files Browse the repository at this point in the history
Export modern CMake interface target
  • Loading branch information
MatthijsBurgh authored Nov 2, 2021
2 parents d1c56f5 + ef1aef5 commit d611b89
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
6 changes: 1 addition & 5 deletions orocos_kdl/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
#
# Test CMake version
#
CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
IF(POLICY CMP0048)
CMAKE_POLICY(SET CMP0048 NEW)
ENDIF()
#MARK_AS_ADVANCED( FORCE CMAKE_BACKWARDS_COMPATIBILITY )
CMAKE_MINIMUM_REQUIRED(VERSION 3.0.2)


###################################################
Expand Down
1 change: 1 addition & 0 deletions orocos_kdl/orocos_kdl-config.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ set(orocos_kdl_INCLUDE_DIRS
${EIGEN3_INCLUDE_DIR}
)
set(orocos_kdl_LIBRARIES orocos-kdl)
set(orocos_kdl_TARGETS orocos-kdl)

# where the .pc pkgconfig files are installed
set(orocos_kdl_PKGCONFIG_DIR "${orocos_kdl_PREFIX}/lib/pkgconfig")
6 changes: 5 additions & 1 deletion orocos_kdl/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@ ENDIF()

ADD_LIBRARY(orocos-kdl ${LIB_TYPE} ${KDL_SRCS} config.h)

TARGET_INCLUDE_DIRECTORIES(orocos-kdl PUBLIC
"$<INSTALL_INTERFACE:include>")

SET_TARGET_PROPERTIES( orocos-kdl PROPERTIES
SOVERSION "${KDL_VERSION_MAJOR}.${KDL_VERSION_MINOR}"
VERSION "${KDL_VERSION}"
Expand All @@ -80,7 +83,8 @@ ENDIF()
#####end RPATH

# Needed so that the generated config.h can be used
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR})
TARGET_INCLUDE_DIRECTORIES(orocos-kdl PUBLIC
"$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}>")
TARGET_LINK_LIBRARIES(orocos-kdl ${Boost_LIBRARIES})

INSTALL(TARGETS orocos-kdl
Expand Down

0 comments on commit d611b89

Please sign in to comment.