@@ -16,46 +16,44 @@ ENDIF(MSVC)
16
16
CONFIGURE_FILE (config.h.in config.h @ONLY)
17
17
18
18
#### 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 )
28
24
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 )
37
33
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!
55
50
ENDIF ()
56
51
#####end RPATH
57
52
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>" )
59
57
60
58
SET_TARGET_PROPERTIES ( orocos-kdl PROPERTIES
61
59
SOVERSION "${KDL_VERSION_MAJOR} .${KDL_VERSION_MINOR} "
@@ -65,22 +63,15 @@ SET_TARGET_PROPERTIES( orocos-kdl PROPERTIES
65
63
)
66
64
67
65
#### 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)
72
67
SET_TARGET_PROPERTIES ( orocos-kdl PROPERTIES
73
68
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 ()
79
69
ENDIF ()
80
70
#####end RPATH
81
71
82
72
# 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} >" )
84
75
TARGET_LINK_LIBRARIES (orocos-kdl ${Boost_LIBRARIES} )
85
76
86
77
INSTALL (TARGETS orocos-kdl
0 commit comments