CMakeLists.txt 2.97 KB
Newer Older
Guilhem Saurel's avatar
Guilhem Saurel committed
1
# Copyright (C) 2010, 2020 Florent Lamiraux, Thomas Moulard, Guilhem Saurel, JRL, CNRS/AIST, LAAS-CNRS
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.

Guilhem Saurel's avatar
Guilhem Saurel committed
16
CMAKE_MINIMUM_REQUIRED(VERSION 3.1)
17
18

SET(PROJECT_NAME hpp-util)
Thomas Moulard's avatar
Thomas Moulard committed
19
SET(PROJECT_DESCRIPTION "Debugging tools for the HPP project.")
20
SET(PROJECT_URL "http://github.com/humanoid-path-planner/hpp-util")
21

Guilhem Saurel's avatar
Guilhem Saurel committed
22
23
24
INCLUDE(cmake/hpp.cmake)
INCLUDE(cmake/boost.cmake)

Thomas Moulard's avatar
Thomas Moulard committed
25
SET(CXX_DISABLE_WERROR 1)
Guilhem Saurel's avatar
Guilhem Saurel committed
26
SET(PROJECT_USE_CMAKE_EXPORT TRUE)
Thomas Moulard's avatar
Thomas Moulard committed
27

Guilhem Saurel's avatar
Guilhem Saurel committed
28
COMPUTE_PROJECT_ARGS(PROJECT_ARGS LANGUAGES CXX C)
Guilhem Saurel's avatar
Guilhem Saurel committed
29
PROJECT(${PROJECT_NAME} ${PROJECT_ARGS})
30

Thomas Moulard's avatar
Thomas Moulard committed
31
# Search for Boost.
Joseph Mirabel's avatar
Joseph Mirabel committed
32
SET(BOOST_COMPONENTS filesystem system serialization)
Thomas Moulard's avatar
Thomas Moulard committed
33
34
SEARCH_FOR_BOOST()

Guilhem Saurel's avatar
Guilhem Saurel committed
35
36
SET(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake/find-external/TinyXML)
FIND_PACKAGE(TinyXML REQUIRED)
Thomas Moulard's avatar
Thomas Moulard committed
37

38
39
40
SET(${PROJECT_NAME}_HEADERS
  include/hpp/util/assertion.hh
  include/hpp/util/debug.hh
Thomas Moulard's avatar
Thomas Moulard committed
41
  include/hpp/util/doc.hh
42
  include/hpp/util/exception.hh
43
  include/hpp/util/exception-factory.hh
44
  include/hpp/util/indent.hh
Florent Lamiraux's avatar
Florent Lamiraux committed
45
  include/hpp/util/pointer.hh
46
47
48
  include/hpp/util/portability.hh
  include/hpp/util/timer.hh
  include/hpp/util/version.hh
Joseph Mirabel's avatar
Joseph Mirabel committed
49
50
51
  include/hpp/util/parser.hh
  include/hpp/util/factories/ignoretag.hh
  include/hpp/util/factories/sequence.hh
Joseph Mirabel's avatar
Joseph Mirabel committed
52
53
  include/hpp/util/serialization.hh
  include/hpp/util/serialization-fwd.hh
Guilhem Saurel's avatar
Guilhem Saurel committed
54
  )
55

Guilhem Saurel's avatar
Guilhem Saurel committed
56
57
58
59
60
61
62
63
64
SET(${PROJECT_NAME}_SOURCES
  src/debug.cc
  src/exception.cc
  src/indent.cc
  src/timer.cc
  src/version.cc
  src/parser.cc
  src/factories/sequence.cc
  )
Thomas Moulard's avatar
Thomas Moulard committed
65

Guilhem Saurel's avatar
Guilhem Saurel committed
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
ADD_LIBRARY(${PROJECT_NAME} SHARED ${${PROJECT_NAME}_SOURCES} ${${PROJECT_NAME}_HEADERS})
TARGET_INCLUDE_DIRECTORIES(${PROJECT_NAME} PRIVATE ${TinyXML_INCLUDE_DIR} ${Boost_INCLUDE_DIRS})
TARGET_INCLUDE_DIRECTORIES(${PROJECT_NAME} PUBLIC $<INSTALL_INTERFACE:include>)
TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${TinyXML_LIBRARY} ${Boost_LIBRARIES})

# Check for unistd.h presence.
INCLUDE(CheckIncludeFiles)
CHECK_INCLUDE_FILES(unistd.h HAVE_UNISTD_H)
IF(${HAVE_UNISTD_H})
  TARGET_COMPILE_DEFINITIONS(${PROJECT_NAME} PRIVATE -DHAVE_UNISTD_H)
ENDIF(${HAVE_UNISTD_H})

# Define logging directory location.
TARGET_COMPILE_DEFINITIONS(${PROJECT_NAME} PRIVATE -DHPP_LOGGINGDIR="${CMAKE_INSTALL_PREFIX}/var/log")

# Set shared library version.
SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES SOVERSION ${PROJECT_VERSION})

INSTALL(TARGETS ${PROJECT_NAME} EXPORT ${TARGETS_EXPORT_NAME} DESTINATION lib)
Joseph Mirabel's avatar
Joseph Mirabel committed
85

86
87
ADD_SUBDIRECTORY(tests)

Guilhem Saurel's avatar
Guilhem Saurel committed
88
PKG_CONFIG_APPEND_LIBS(${PROJECT_NAME})
89
PKG_CONFIG_APPEND_BOOST_LIBS(${BOOST_COMPONENTS})