added set functionality, the basics are in place for hooking up the backend service
[profile/ivi/automotive-message-broker.git] / CMakeLists.txt
1 project(automotive-message-broker)
2 cmake_minimum_required(VERSION 2.8)
3
4 include(FindPkgConfig)
5
6 set(PROJECT_NAME "automotive-message-broker")
7 set(PROJECT_VERSION "0.2.2")
8
9 add_definitions(-DPROJECT_VERSION="${PROJECT_VERSION}")
10 add_definitions(-DPROJECT_NAME="${PROJECT_NAME}")
11
12 set (LIB_SUFFIX "" CACHE STRING "Define suffix of directory name (32/64)" )
13 set (LIB_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX}/${CMAKE_LIBRARY_ARCHITECTURE}" CACHE STRING "Directory where lib will install")
14 set (INCLUDE_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/include" CACHE PATH "The directory the headers are installed in")
15 set (DOC_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/share/doc/${PROJECT_NAME}" CACHE PATH "The directory the docs will be installed to")
16
17 option(use_qtcore "Use QCoreApplication mainloop " OFF)
18
19 find_library(libtool_LIBRARY ltdl DOC "Libtool libraries")
20 find_path(libtool_INCLUDE_DIR ltdl.h DOC "Libtool headers")
21 find_package(Boost REQUIRED)
22
23 pkg_check_modules(glib REQUIRED glib-2.0)
24 pkg_check_modules(json REQUIRED json-glib-1.0)
25
26 add_definitions(-std=c++0x)
27 add_definitions(-DDBusServiceName="org.automotive.message.broker")
28
29 set(include_dirs ${libtool_INCLUDE_DIR} ${glib_INCLUDE_DIRS} ${gio_INCLUDE_DIRS} ${Boost_INCLUDE_DIRS} ${json_INCLUDE_DIRS} ${CMAKE_CURRENT_SOURCE_DIR}/lib)
30 set(link_libraries -lamb ${libtool_LIBRARY} ${glib_LIBRARIES} ${json_LIBRARIES} -L${CMAKE_CURRENT_BINARY_DIR}/lib)
31
32 if(use_qtcore)
33
34         find_package( Qt4 REQUIRED )
35         set( QT_DONT_USE_QTGUI TRUE )
36         include(${QT_USE_FILE})
37         set(include_dirs ${include_dirs} ${qt_INCLUDE_DIRS})
38         set(link_libraries ${link_libraries} ${qt_LIBRARIES})
39
40         add_definitions(-DUSE_QT_CORE)
41
42 endif(use_qtcore)
43
44 add_custom_target(uninstall "${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake")
45
46 set(ARCHIVE_NAME ${CMAKE_PROJECT_NAME}-${PROJECT_VERSION})
47 add_custom_target(dist COMMAND git archive --prefix=${ARCHIVE_NAME}/ HEAD | bzip2 > ${CMAKE_BINARY_DIR}/${ARCHIVE_NAME}.tar.bz2 WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
48
49 add_subdirectory(lib)
50 add_subdirectory(ambd)
51 add_subdirectory(plugins)
52 add_subdirectory(docs)
53 add_subdirectory(tests)