@@ -16,46 +16,44 @@ ENDIF(MSVC)
1616CONFIGURE_FILE (config.h.in config.h @ONLY)
1717
1818#### Settings for rpath
19- IF (${CMAKE_MINIMUM_REQUIRED_VERSION} VERSION_GREATER "2.8.12" )
20- MESSAGE (AUTHOR_WARNING "CMAKE_MINIMUM_REQUIRED_VERSION is now ${CMAKE_MINIMUM_REQUIRED_VERSION} . This check can be removed." )
21- ENDIF ()
22- IF (NOT (CMAKE_VERSION VERSION_LESS 2.8.12))
23- IF (NOT MSVC )
24- #add the option to disable RPATH
25- OPTION (OROCOSKDL_ENABLE_RPATH "Enable RPATH during installation" TRUE )
26- MARK_AS_ADVANCED (OROCOSKDL_ENABLE_RPATH)
27- ENDIF (NOT MSVC )
19+ IF (NOT MSVC )
20+ #add the option to disable RPATH
21+ OPTION (OROCOSKDL_ENABLE_RPATH "Enable RPATH during installation" TRUE )
22+ MARK_AS_ADVANCED (OROCOSKDL_ENABLE_RPATH)
23+ ENDIF (NOT MSVC )
2824
29- IF (OROCOSKDL_ENABLE_RPATH)
30- #Configure RPATH
31- SET (CMAKE_MACOSX_RPATH TRUE ) #enable RPATH on OSX. This also suppress warnings on CMake >= 3.0
32- # when building, don't use the install RPATH already
33- # (but later on when installing)
34- SET (CMAKE_BUILD_WITH_INSTALL_RPATH FALSE )
35- #build directory by default is built with RPATH
36- SET (CMAKE_SKIP_BUILD_RPATH FALSE )
25+ IF (OROCOSKDL_ENABLE_RPATH)
26+ #Configure RPATH
27+ SET (CMAKE_MACOSX_RPATH TRUE ) #enable RPATH on OSX. This also suppress warnings on CMake >= 3.0
28+ # when building, don't use the install RPATH already
29+ # (but later on when installing)
30+ SET (CMAKE_BUILD_WITH_INSTALL_RPATH FALSE )
31+ #build directory by default is built with RPATH
32+ SET (CMAKE_SKIP_BUILD_RPATH FALSE )
3733
38- #This is relative RPATH for libraries built in the same project
39- #I assume that the directory is
40- # - install_dir/something for binaries
41- # - install_dir/lib for libraries
42- LIST (FIND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES "${CMAKE_INSTALL_PREFIX} /lib" isSystemDir)
43- IF ("${isSystemDir} " STREQUAL "-1" )
44- FILE (RELATIVE_PATH _rel_path "${CMAKE_INSTALL_PREFIX} /bin" "${CMAKE_INSTALL_PREFIX} /lib" )
45- IF (${CMAKE_SYSTEM_NAME} MATCHES "Darwin" )
46- SET (CMAKE_INSTALL_RPATH "@loader_path/${_rel_path} " )
47- ELSE ()
48- SET (CMAKE_INSTALL_RPATH "\$ ORIGIN/${_rel_path} " )
49- ENDIF ()
50- ENDIF ("${isSystemDir} " STREQUAL "-1" )
51- # add the automatically determined parts of the RPATH
52- # which point to directories outside the build tree to the install RPATH
53- SET (CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE ) #very important!
54- ENDIF ()
34+ #This is relative RPATH for libraries built in the same project
35+ #I assume that the directory is
36+ # - install_dir/something for binaries
37+ # - install_dir/lib for libraries
38+ LIST (FIND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES "${CMAKE_INSTALL_PREFIX} /lib" isSystemDir)
39+ IF ("${isSystemDir} " STREQUAL "-1" )
40+ FILE (RELATIVE_PATH _rel_path "${CMAKE_INSTALL_PREFIX} /bin" "${CMAKE_INSTALL_PREFIX} /lib" )
41+ IF (${CMAKE_SYSTEM_NAME} MATCHES "Darwin" )
42+ SET (CMAKE_INSTALL_RPATH "@loader_path/${_rel_path} " )
43+ ELSE ()
44+ SET (CMAKE_INSTALL_RPATH "\$ ORIGIN/${_rel_path} " )
45+ ENDIF ()
46+ ENDIF ("${isSystemDir} " STREQUAL "-1" )
47+ # add the automatically determined parts of the RPATH
48+ # which point to directories outside the build tree to the install RPATH
49+ SET (CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE ) #very important!
5550ENDIF ()
5651#####end RPATH
5752
58- ADD_LIBRARY (orocos-kdl ${LIB_TYPE} ${KDL_SRCS} config.h)
53+ ADD_LIBRARY (orocos-kdl ${LIB_TYPE} ${KDL_SRCS} )
54+
55+ TARGET_INCLUDE_DIRECTORIES (orocos-kdl PUBLIC
56+ "$<INSTALL_INTERFACE:include>" )
5957
6058SET_TARGET_PROPERTIES ( orocos-kdl PROPERTIES
6159 SOVERSION "${KDL_VERSION_MAJOR} .${KDL_VERSION_MINOR} "
@@ -65,22 +63,15 @@ SET_TARGET_PROPERTIES( orocos-kdl PROPERTIES
6563 )
6664
6765#### Settings for rpath disabled (back-compatibility)
68- IF (${CMAKE_MINIMUM_REQUIRED_VERSION} VERSION_GREATER "2.8.12" )
69- MESSAGE (AUTHOR_WARNING "CMAKE_MINIMUM_REQUIRED_VERSION is now ${CMAKE_MINIMUM_REQUIRED_VERSION} . This check can be removed." )
70- ENDIF ()
71- IF (CMAKE_VERSION VERSION_LESS 2.8.12)
66+ IF (NOT OROCOSKDL_ENABLE_RPATH)
7267 SET_TARGET_PROPERTIES ( orocos-kdl PROPERTIES
7368 INSTALL_NAME_DIR "${CMAKE_INSTALL_PREFIX} /lib${LIB_SUFFIX} " )
74- ELSE ()
75- IF (NOT OROCOSKDL_ENABLE_RPATH)
76- SET_TARGET_PROPERTIES ( orocos-kdl PROPERTIES
77- INSTALL_NAME_DIR "${CMAKE_INSTALL_PREFIX} /lib${LIB_SUFFIX} " )
78- ENDIF ()
7969ENDIF ()
8070#####end RPATH
8171
8272# Needed so that the generated config.h can be used
83- INCLUDE_DIRECTORIES (${CMAKE_CURRENT_BINARY_DIR} )
73+ TARGET_INCLUDE_DIRECTORIES (orocos-kdl PUBLIC
74+ "$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR} >" )
8475TARGET_LINK_LIBRARIES (orocos-kdl ${Boost_LIBRARIES} )
8576
8677INSTALL (TARGETS orocos-kdl
0 commit comments