CMakeLists.txt 2.58 KB
Newer Older
Thomas Moulard's avatar
Thomas Moulard committed
1
# Copyright 2010, Olivier Stasse, JRL, CNRS/AIST
2
#
Thomas Moulard's avatar
Thomas Moulard committed
3
4
5
6
7
# This file is part of dynamic-graph.
# dynamic-graph is free software: you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public License
# as published by the Free Software Foundation, either version 3 of
# the License, or (at your option) any later version.
8
#
Thomas Moulard's avatar
Thomas Moulard committed
9
10
11
12
13
14
# dynamic-graph 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 Lesser Public License for more details.  You should have
# received a copy of the GNU Lesser General Public License along with
# dynamic-graph. If not, see <http://www.gnu.org/licenses/>.
15
16
17

CMAKE_MINIMUM_REQUIRED(VERSION 2.6)

18
INCLUDE(cmake/base.cmake)
19

20
21
22
23
SET(PROJECT_NAME dynamic-graph)
SET(PROJECT_VERSION 1.0.0.99)
SET(PROJECT_DESCRIPTION "Dynamic graph library")
SET(PROJECT_URL "http://github.com/jrl-umi3218/dynamic-graph")
24

25
# Defines paths.
26
SET(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/lib)
27

28
29
# Disable -Werror on Unix for now.
SET(CXX_DISABLE_WERROR True)
30

31
SETUP_PROJECT()
32

33
34
35
# FIXME: to be changed into lib/dynamic-graph
# to avoid name collision when installing dynamic-graph in /usr.
SET(PLUGINDIR "lib/plugin")
36

37
38
39
40
41
# Add extra keys to pkg-config file to export the location of the
# plug-in directory in a robust manner.
SET(PKG_CONFIG_EXTRA
  "plugindirname=${PLUGINDIR}
plugindir=${CMAKE_INSTALL_PREFIX}/${PLUGINDIR}")
42

43
44
# Add dependency toward dynamic graph library in pkg-config file.
SET(PKG_CONFIG_LIBS "${PKG_CONFIG_LIBS} ${LIBINCL_KW}dynamic-graph${LIB_EXT}")
45

46
47
48
49
50
51
# Search for Boost.
SET(Boost_USE_STATIC_LIBS OFF)
SET(Boost_USE_MULTITHREAD ON)
FIND_PACKAGE(Boost 1.33 COMPONENTS thread REQUIRED)
SET(PKG_CONFIG_CFLAGS "${PKG_CONFIG_CFLAGS} -I${Boost_INCLUDE_DIR}")
SET(PKG_CONFIG_LIBS "${PKG_CONFIG_LIBS} ${LIBDIR_KW}${Boost_LIBRARY_DIRS}")
52

53
ADD_DEFINITIONS(-DHAVE_LIBBOOST_THREAD)
54

55
56
# Search for Pthread.
INCLUDE(FindThreads)
57
IF(UNIX)
58
59
60
61
62
63
64
65
66
67
68
  IF(CMAKE_USE_PTHREADS_INIT)
    ADD_DEFINITIONS(-pthread)
  ELSE(CMAKE_USE_PTHREADS_INIT)
    MESSAGE(FATAL_ERROR
      "Pthread is required on Unix, but "
      ${CMAKE_THREAD_LIBS_INIT} " has been detected.")
  ENDIF(CMAKE_USE_PTHREADS_INIT)
ELSEIF(WIN32)
  # Nothing to do.
ELSE(UNIX)
  MESSAGE(FATAL_ERROR "Thread support for this platform is not implemented.")
69
70
ENDIF(UNIX)

71
# Remove additional warnings.
72
IF(WIN32)
73
  ADD_DEFINITIONS("/wd4251 /wd4275 /wd4101 /wd4355")
74
75
ENDIF(WIN32)

76
77
ADD_SUBDIRECTORY(src)
ADD_SUBDIRECTORY(include)
78
ADD_SUBDIRECTORY(tools)
79
ADD_SUBDIRECTORY(doc)
Francois Bleibel's avatar
Francois Bleibel committed
80
ADD_SUBDIRECTORY(unitTesting)
81
82

SETUP_PROJECT_FINALIZE()