CMakeLists.txt 2.99 KB
Newer Older
Guillem Alenyà's avatar
Guillem Alenyà committed
1
2
3
4
5
6
7
8
9
# Pre-requisites about cmake itself
CMAKE_MINIMUM_REQUIRED(VERSION 2.4)

if(COMMAND cmake_policy)
  cmake_policy(SET CMP0005 NEW) 
  cmake_policy(SET CMP0003 NEW) 
endif(COMMAND cmake_policy)

# The project name and the type of project
10
11
PROJECT(segway_rmp_400)
SET(PACKAGE_NAME segway-rmp-400)
Guillem Alenyà's avatar
Guillem Alenyà committed
12
13
14

SET(EXECUTABLE_OUTPUT_PATH ${CMAKE_CURRENT_SOURCE_DIR}/bin)
SET(LIBRARY_OUTPUT_PATH ${CMAKE_CURRENT_SOURCE_DIR}/lib)
Guillem Alenyà's avatar
Guillem Alenyà committed
15
16
17
18
19
20
21
22

IF ("${INSTALL_DIR}" STREQUAL "")
  MESSAGE ("[INSTALL] set install_dir to /usr/local")
  SET(CMAKE_INSTALL_PREFIX /usr/local)
ELSE ()
  MESSAGE ("[INSTALL] set install_dir to input ${INSTALL_DIR}")
  SET(CMAKE_INSTALL_PREFIX ${INSTALL_DIR})
ENDIF ()
Guillem Alenyà's avatar
Guillem Alenyà committed
23
24
25
26
27

IF (NOT CMAKE_BUILD_TYPE)
 SET(CMAKE_BUILD_TYPE "DEBUG") 
ENDIF (NOT CMAKE_BUILD_TYPE)

28
29
SET(CMAKE_CXX_FLAGS_DEBUG "-g -Wall")
SET(CMAKE_CXX_FLAGS_RELEASE "-O3")
Guillem Alenyà's avatar
Guillem Alenyà committed
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

ADD_SUBDIRECTORY(src/)
ADD_SUBDIRECTORY(test/)

FIND_PACKAGE(Doxygen)

FIND_PATH(IRI_DOC_DIR doxygen.conf ${CMAKE_SOURCE_DIR}/doc/iri_doc/)
IF (IRI_DOC_DIR)
  ADD_CUSTOM_TARGET (doc ${DOXYGEN_EXECUTABLE} ${CMAKE_SOURCE_DIR}/doc/iri_doc/doxygen.conf)
ELSE (IRI_DOC_DIR)
  ADD_CUSTOM_TARGET (doc ${DOXYGEN_EXECUTABLE} ${CMAKE_SOURCE_DIR}/doc/doxygen.conf)
ENDIF (IRI_DOC_DIR)

ADD_CUSTOM_TARGET (distclean @echo cleaning cmake files)

IF (UNIX)
  ADD_CUSTOM_COMMAND(
    COMMENT "distribution clean"
    COMMAND make ARGS clean
    COMMAND rm ARGS -rf ${CMAKE_SOURCE_DIR}/build/*

    TARGET  distclean
  )
ELSE(UNIX)
  ADD_CUSTOM_COMMAND(
    COMMENT "distclean only implemented in unix"
    TARGET  distclean
  )
ENDIF(UNIX)

ADD_CUSTOM_TARGET (uninstall @echo uninstall package)

IF (UNIX)
  ADD_CUSTOM_COMMAND(
    COMMENT "uninstall package"
    COMMAND xargs ARGS rm < install_manifest.txt

    TARGET  uninstall
  )
ELSE(UNIX)
  ADD_CUSTOM_COMMAND(
    COMMENT "uninstall only implemented in unix"
    TARGET  uninstall
  )
ENDIF(UNIX)

IF (UNIX)
77
78
79
80
81
82
83
84
85
86
87
88
    SET(CPACK_PACKAGE_FILE_NAME "iri-${PACKAGE_NAME}-dev-${CPACK_PACKAGE_VERSION}-${CPACK_DEBIAN_PACKAGE_ARCHITECTURE}")
    SET(CPACK_PACKAGE_NAME "iri-${PACKAGE_NAME}-dev")
    SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Part of IRI-laboratory libraries. More information at https://gitlab.iri.upc.edu/labrobotica")
    SET(CPACK_PACKAGING_INSTALL_PREFIX /usr)
    SET(CPACK_GENERATOR "DEB")
    SET(CPACK_DEBIAN_PACKAGE_MAINTAINER "labrobotica - labrobotica@iri.upc.edu")

  # Uncomment to add the necessary mantainer scripts
  #   SET(CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA "${CMAKE_SOURCE_DIR}/scripts/debian/preinst;${CMAKE_SOURCE_DIR}/scripts/debian/postinst;${CMAKE_SOURCE_DIR}/scripts/debian/prerm;${CMAKE_SOURCE_DIR}/scripts/debian/postrm")

  # Uncomment to add dependencies comma separated
  # SET(CPACK_DEBIAN_PACKAGE_DEPENDS "iri-<package_name>-dev (>= 1.0~${DISTRIB})")
Fernando Herrero's avatar
Fernando Herrero committed
89
    SET(CPACK_DEBIAN_PACKAGE_DEPENDS "iri-iriutils-dev (>= 1.0~${DISTRIB}), iri-comm-dev (>= 1.0~${DISTRIB}), iri-segway-rmp-200-dev (>= 1.0~${DISTRIB})")
90
91
92
93
94
95
96

    INCLUDE(CPack)
  ELSE(UNIX)
    ADD_CUSTOM_COMMAND(
      COMMENT "packaging only implemented in unix"
      TARGET  uninstall
    )
97
  ENDIF(UNIX)