forked from robotology-legacy/wholebodyinterface
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
129 lines (99 loc) · 4.42 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
# Copyright: (C) 2013 CoDyCo Consortium
# Authors: Andrea Del Prete
# CopyPolicy: Released under the terms of the GNU GPL v2.0 (or any later version).
cmake_minimum_required(VERSION 2.8.11)
SET(PROJECTNAME wholeBodyInterface)
SET(LIBRARYNAME whole-body-interface)
SET(HEADERSDIRECTORY wbi)
PROJECT(${PROJECTNAME})
set (${PROJECTNAME}_VERSION_MAJOR 0)
set (${PROJECTNAME}_VERSION_MINOR 2)
set (${PROJECTNAME}_VERSION_PATCH 6)
set (${PROJECTNAME}_VERSION ${${PROJECTNAME}_VERSION_MAJOR}.${${PROJECTNAME}_VERSION_MINOR}.${${PROJECTNAME}_VERSION_PATCH})
message (STATUS "${PROJECT_NAME} version ${${PROJECTNAME}_VERSION}")
option(WBI_ENABLE_RPATH "Enable RPATH for the library" TRUE)
mark_as_advanced(WBI_ENABLE_RPATH)
SET( PROJ_SOURCE_DIR ${${PROJECTNAME}_SOURCE_DIR} )
SET( PROJ_BINARY_DIR ${${PROJECTNAME}_BINARY_DIR} )
# set the default build type
if (NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release)
endif()
# This shouldn't be necessary, but there has been trouble
# with MSVC being set off, but MSVCXX ON.
if(MSVC OR MSVC90 OR MSVC10)
set(MSVC ON)
endif (MSVC OR MSVC90 OR MSVC10)
set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
if(MSVC)
set(CMAKE_DEBUG_POSTFIX "d")
endif(MSVC)
SET(folder_source src/wbiUtil.cpp
src/wbiID.cpp
src/wbiConstants.cpp
src/iWholeBodyModel.cpp
src/iWholeBodyStates.cpp
src/iWholeBodySensors.cpp
src/iWholeBodyActuators.cpp
src/wholeBodyInterface.cpp
src/Error.cpp)
SET(folder_header include/wbi/wbi.h
include/wbi/wbiConstants.h
include/wbi/wbiUtil.h
include/wbi/wbiID.h
include/wbi/wbiUtil.inl
include/wbi/iWholeBodyModel.h
include/wbi/iWholeBodyStates.h
include/wbi/iWholeBodySensors.h
include/wbi/iWholeBodyActuators.h
include/wbi/wholeBodyInterface.h
include/wbi/Error.h)
include_directories(include/wbi)
SOURCE_GROUP("Source Files" FILES ${folder_source})
SOURCE_GROUP("Header Files" FILES ${folder_header})
if(MSVC)
set(LIB_TYPE STATIC)
else()
set(LIB_TYPE SHARED)
endif()
find_package(YCM REQUIRED)
include(YCMDefaultDirs)
include(AddInstallRPATHSupport)
add_install_rpath_support(BIN_DIRS "${CMAKE_INSTALL_PREFIX}/bin"
LIB_DIRS "${CMAKE_INSTALL_PREFIX}/lib"
DEPENDS WBI_ENABLE_RPATH
USE_LINK_PATH)
add_library(${LIBRARYNAME} ${LIB_TYPE} ${folder_source} ${folder_header})
SET_TARGET_PROPERTIES(${LIBRARYNAME} PROPERTIES
SOVERSION "${${PROJECTNAME}_VERSION_MAJOR}.${${PROJECTNAME}_VERSION_MINOR}"
VERSION "${${PROJECTNAME}_VERSION}"
COMPILE_FLAGS "${CMAKE_CXX_FLAGS_ADD}"
PUBLIC_HEADER "${folder_header}"
)
if(${CMAKE_MINIMUM_REQUIRED_VERSION} VERSION_GREATER "2.8.12")
message(AUTHOR_WARNING "CMAKE_MINIMUM_REQUIRED_VERSION is now ${CMAKE_MINIMUM_REQUIRED_VERSION}. This check can be removed.")
endif()
if(CMAKE_VERSION VERSION_LESS 2.8.12)
if(NOT WBI_DISABLE_RPATH)
set_target_properties(${LIBRARYNAME} PROPERTIES
INSTALL_NAME_DIR "${CMAKE_INSTALL_PREFIX}/lib"
)
endif(NOT WBI_DISABLE_RPATH)
endif(CMAKE_VERSION VERSION_LESS 2.8.12)
target_include_directories(${LIBRARYNAME} PUBLIC "$<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/include>"
"$<INSTALL_INTERFACE:${CMAKE_INSTALL_PREFIX}/${${VARS_PREFIX}_INSTALL_INCLUDEDIR}>")
INSTALL(TARGETS ${LIBRARYNAME}
EXPORT ${PROJECTNAME}-target
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib
PUBLIC_HEADER DESTINATION include/${HEADERSDIRECTORY}
)
INSTALL(DIRECTORY include/${HEADERSDIRECTORY} DESTINATION include/${HEADERSDIRECTORY})
EXPORT(TARGETS ${LIBRARYNAME} FILE "${PROJECT_BINARY_DIR}/${PROJECTNAME}-target.cmake")
#EXPORT(PACKAGE ${PROJECTNAME})
CONFIGURE_FILE(cmake/${PROJECTNAME}Config.cmake.in ${PROJECT_BINARY_DIR}/${PROJECTNAME}Config.cmake @ONLY)
CONFIGURE_FILE(cmake/${PROJECTNAME}ConfigVersion.cmake.in ${PROJECT_BINARY_DIR}/${PROJECTNAME}ConfigVersion.cmake @ONLY)
INSTALL(FILES ${PROJECT_BINARY_DIR}/${PROJECTNAME}Config.cmake DESTINATION share/${PROJECTNAME})
INSTALL(FILES ${PROJECT_BINARY_DIR}/${PROJECTNAME}ConfigVersion.cmake DESTINATION share/${PROJECTNAME})
INSTALL(EXPORT ${PROJECTNAME}-target DESTINATION share/${PROJECTNAME})
include(AddUninstallTarget)