Debian Codegraph @

orocos_kdl/src/CMakeLists.txt

raw ◀ ▶
Source reconstructed at patch state 0 of 1 — not the installed (fully patched) source.
1 Debian patch touch this file
1 FILE( GLOB_RECURSE KDL_SRCS [^.]*.cpp [^.]*.cxx)
2 FILE( GLOB KDL_HPPS [^.]*.hpp [^.]*.inl)
3
4 FILE( GLOB UTIL_HPPS utilities/[^.]*.h utilities/[^.]*.hpp)
5
6 #In Windows (Visual Studio) it is necessary to specify the postfix
7 #of the debug library name and no symbols are exported by kdl,
8 #so it is necessary to compile it as a static library
9 IF(MSVC)
10 SET(CMAKE_DEBUG_POSTFIX "d")
11 SET(LIB_TYPE STATIC)
12 ELSE(MSVC)
13 SET(LIB_TYPE SHARED)
14 ENDIF(MSVC)
15
16 CONFIGURE_FILE(config.h.in config.h @ONLY)
17
18 #### Settings for rpath
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)
24
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)
33
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!
50 ENDIF()
51 #####end RPATH
52
53 ADD_LIBRARY(orocos-kdl ${LIB_TYPE} ${KDL_SRCS})
54
55 TARGET_INCLUDE_DIRECTORIES(orocos-kdl PUBLIC
56 "$<INSTALL_INTERFACE:include>")
57
58 SET_TARGET_PROPERTIES( orocos-kdl PROPERTIES
59 SOVERSION "${KDL_VERSION_MAJOR}.${KDL_VERSION_MINOR}"
60 VERSION "${KDL_VERSION}"
61 COMPILE_FLAGS "${CMAKE_CXX_FLAGS_ADD} ${KDL_CFLAGS}"
62 PUBLIC_HEADER "${KDL_HPPS};${CMAKE_CURRENT_BINARY_DIR}/config.h"
63 )
64
65 #### Settings for rpath disabled (back-compatibility)
66 IF(NOT OROCOSKDL_ENABLE_RPATH)
67 SET_TARGET_PROPERTIES( orocos-kdl PROPERTIES
68 INSTALL_NAME_DIR "${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX}")
69 ENDIF()
70 #####end RPATH
71
72 # Needed so that the generated config.h can be used
73 TARGET_INCLUDE_DIRECTORIES(orocos-kdl PUBLIC
74 "$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}>")
75 TARGET_LINK_LIBRARIES(orocos-kdl ${Boost_LIBRARIES})
76
77 INSTALL(TARGETS orocos-kdl
78 EXPORT OrocosKDLTargets
79 ARCHIVE DESTINATION lib${LIB_SUFFIX}
80 LIBRARY DESTINATION lib${LIB_SUFFIX}
81 RUNTIME DESTINATION bin
82 PUBLIC_HEADER DESTINATION include/kdl
83 )
84
85 INSTALL(FILES ${UTIL_HPPS} DESTINATION include/kdl/utilities)