1 project(automotive-message-broker)
2 cmake_minimum_required(VERSION 2.8)
4 set(CMAKE_BUILD_TYPE, Debug)
8 set(PROJECT_NAME "automotive-message-broker")
9 set(PROJECT_VERSION "0.7.9")
11 add_definitions(-DPROJECT_VERSION="${PROJECT_VERSION}")
12 add_definitions(-DPROJECT_NAME="${PROJECT_NAME}")
14 set (LIB_SUFFIX "" CACHE STRING "Define suffix of directory name (32/64)" )
15 set (LIB_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX}/${CMAKE_LIBRARY_ARCHITECTURE}" CACHE STRING "Directory where lib will install")
16 set (INCLUDE_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/include" CACHE PATH "The directory the headers are installed in")
17 set (DOC_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/share/doc/${PROJECT_NAME}" CACHE PATH "The directory the docs will be installed to")
19 option(use_qtcore "Use QCoreApplication mainloop " OFF)
20 option(tpms_plugin "TPMS plugin " OFF)
21 option(obd2_plugin "OBD-II plugin" ON)
22 option(database_plugin "Database plugins" OFF)
23 option(qt_bindings "AMB Qt DBus bindings" OFF)
24 option(opencvlux_plugin "OpenCV Lux plugin" OFF)
25 option(gpsd_plugin "gpsd location plugin" OFF)
26 option(murphy_plugin "murphy policy framework plugin" OFF)
29 message(STATUS "OpenCV Lux plugin enabled")
31 endif(opencvlux_plugin)
33 include (CMakeForceCompiler)
34 option(ENABLE_ICECC "Enable icecc checking, for distributed compilation" OFF)
37 find_program(ICECC icecc)
39 message(STATUS "icecc will be used for distributed compiling")
40 cmake_force_cxx_compiler(${ICECC} icecc)
42 message(STATUS "Not using icecc")
46 find_library(libtool_LIBRARY ltdl DOC "Libtool libraries")
47 find_path(libtool_INCLUDE_DIR ltdl.h DOC "Libtool headers")
50 message(STATUS "libtool found")
52 message(FATAL_ERROR "libtool missing. please install libtool")
53 endif(libtool_LIBRARY)
55 find_package(Boost REQUIRED)
58 pkg_check_modules(glib REQUIRED glib-2.0 gobject-2.0)
59 pkg_check_modules(json REQUIRED json)
62 add_definitions(-std=c++0x)
63 add_definitions(-DDBusServiceName="org.automotive.message.broker")
65 set(include_dirs ${libtool_INCLUDE_DIR} ${glib_INCLUDE_DIRS} ${gio_INCLUDE_DIRS} ${Boost_INCLUDE_DIRS} ${json_INCLUDE_DIRS} ${CMAKE_CURRENT_SOURCE_DIR}/lib)
66 set(link_libraries -lamb ${libtool_LIBRARY} ${glib_LIBRARIES} ${json_LIBRARIES} -L${CMAKE_CURRENT_BINARY_DIR}/lib)
69 message(STATUS "using Qt mainloop")
71 find_package( Qt4 REQUIRED )
73 include(${QT_USE_FILE})
74 set(include_dirs ${include_dirs} ${QT_INCLUDE_DIRS})
75 set(link_libraries ${link_libraries} ${QT_LIBRARIES})
77 add_definitions(-DUSE_QT_CORE)
78 add_definitions(-DQT_NO_KEYWORDS)
82 set(ARCHIVE_NAME ${CMAKE_PROJECT_NAME}-${PROJECT_VERSION})
83 add_custom_target(dist COMMAND git archive --prefix=${ARCHIVE_NAME}/ HEAD | bzip2 > ${CMAKE_BINARY_DIR}/${ARCHIVE_NAME}.tar.bz2 WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
85 configure_file("${CMAKE_CURRENT_SOURCE_DIR}/cmake_uninstall.cmake" "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake" IMMEDIATE @ONLY)
86 add_custom_target(uninstall "${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake")
89 add_subdirectory(ambd)
90 add_subdirectory(plugins)
91 add_subdirectory(docs)
92 add_subdirectory(tests)