CMakeLists.txt 2.93 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.
32
ADD_PROJECT_DEPENDENCY(Boost REQUIRED COMPONENTS filesystem serialization)
Thomas Moulard's avatar
Thomas Moulard committed
33

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

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

Guilhem Saurel's avatar
Guilhem Saurel committed
55
56
57
58
59
60
61
62
63
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
64

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

# 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
84

85
86
ADD_SUBDIRECTORY(tests)

Guilhem Saurel's avatar
Guilhem Saurel committed
87
PKG_CONFIG_APPEND_LIBS(${PROJECT_NAME})