Updated release notes
[profile/ivi/dlt-daemon.git] / CMakeLists.txt
1 #######\r
2 # Dlt - Diagnostic Log and Trace\r
3 # @licence make begin@\r
4  #\r
5  # Copyright (C) 2011, BMW AG - Alexander Wenzel <alexander.wenzel@bmw.de>\r
6  # \r
7  # This program is free software; you can redistribute it and/or modify it under the terms of the \r
8  # GNU Lesser General Public License, version 2.1, as published by the Free Software Foundation.\r
9  # This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even \r
10  # the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General \r
11  # Public License, version 2.1, for more details.\r
12  # \r
13  # You should have received a copy of the GNU Lesser General Public License, version 2.1, along \r
14  # with this program; if not, see <http://www.gnu.org/licenses/lgpl-2.1.html>.\r
15  # \r
16  # Note that the copyright holders assume that the GNU Lesser General Public License, version 2.1, may \r
17  # also be applicable to programs even in cases in which the program is not a library in the technical sense.\r
18  # \r
19  # Linking DLT statically or dynamically with other modules is making a combined work based on DLT. You may \r
20  # license such other modules under the GNU Lesser General Public License, version 2.1. If you do not want to \r
21  # license your linked modules under the GNU Lesser General Public License, version 2.1, you \r
22  # may use the program under the following exception.\r
23  # \r
24  # As a special exception, the copyright holders of DLT give you permission to combine DLT \r
25  # with software programs or libraries that are released under any license unless such a combination is not\r
26  # permitted by the license of such a software program or library. You may copy and distribute such a \r
27  # system following the terms of the GNU Lesser General Public License, version 2.1, including this\r
28  # special exception, for DLT and the licenses of the other code concerned.\r
29  # \r
30  # Note that people who make modified versions of DLT are not obligated to grant this special exception \r
31  # for their modified versions; it is their choice whether to do so. The GNU Lesser General Public License, \r
32  # version 2.1, gives permission to release a modified version without this exception; this exception \r
33  # also makes it possible to release a modified version which carries forward this exception.\r
34  #\r
35  # @licence end@\r
36 ########\r
37 \r
38 cmake_minimum_required( VERSION 2.6 )\r
39 project( automotive-dlt )\r
40 \r
41 mark_as_advanced( CMAKE_BACKWARDS_COMPATIBILITY)\r
42 set( CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS TRUE )\r
43 \r
44 # Set version parameters\r
45 set( DLT_MAJOR_VERSION 2)\r
46 set( DLT_MINOR_VERSION 5)\r
47 set( DLT_PATCH_LEVEL 1)\r
48 set( DLT_VERSION ${DLT_MAJOR_VERSION}.${DLT_MINOR_VERSION}.${DLT_PATCH_LEVEL})\r
49 set( DLT_VERSION_STATE RELEASE )\r
50 set( DLT_REVISION "")\r
51 \r
52 execute_process(COMMAND git describe --tags WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} \r
53         OUTPUT_VARIABLE DLT_REVISION\r
54         ERROR_VARIABLE GIT_ERROR \r
55         OUTPUT_STRIP_TRAILING_WHITESPACE\r
56         ERROR_STRIP_TRAILING_WHITESPACE)\r
57 if( DLT_REVISION MATCHES "^$")\r
58         set( PRINT_REVISION "Git revision unavailable")\r
59 else( DLT_REVISION MATCHES "")\r
60         string(REPLACE "-" "_" DLT_REVISION ${DLT_REVISION})\r
61         set( PRINT_REVISION ${DLT_REVISION})    \r
62 endif( DLT_REVISION MATCHES "^$")\r
63 \r
64 # set default build type, if not defined by user\r
65 if(NOT CMAKE_BUILD_TYPE)\r
66     set(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING\r
67                          "Choose build type: Debug, Release, RelWithDebInfo, MinSizeRel."\r
68                          FORCE)\r
69     message(STATUS "Build type not defined. Using default build type 'RelWithDebInfo'.")\r
70 endif(NOT CMAKE_BUILD_TYPE)\r
71 \r
72 # Set of indiviual options\r
73 option(BUILD_SHARED_LIBS      "Set to OFF to build static libraries"                 ON  )\r
74 option(WITH_DLT_SHM_ENABLE    "Set to OFF to use FIFO as IPC from user to daemon"    OFF )\r
75 option(WITH_DOC               "Set to ON to build documentation target"              OFF )\r
76 option(WITH_MAN               "Set to OFF to skip building of man pages"             ON )\r
77 option(WITH_CHECK_CONFIG_FILE "Set to ON to create a configure file of CheckIncludeFiles and CheckFunctionExists " OFF )\r
78 option(WITH_TESTSCRIPTS       "Set to ON to run CMakeLists.txt in testscripts"       OFF )\r
79 option(WITH_SYSTEMD           "Set to ON to run CMakeLists.txt in systemd"           OFF )\r
80 option(WITH_GPROF             "Set -pg to compile flags"                             OFF )\r
81 option(WITH_DLTTEST                       "Set to ON to build with modifications to test Uuser-Daemon communication with corrupt messages" OFF)\r
82 \r
83 # RPM settings\r
84 set( GENIVI_RPM_RELEASE "1")#${DLT_REVISION}")\r
85 set( LICENSE "LGPL v2.1 with special exception" )\r
86 \r
87 # Build, project and include settings\r
88 find_package(Threads REQUIRED)\r
89 \r
90 include_directories( \r
91     ${CMAKE_SOURCE_DIR}/\r
92     ${CMAKE_SOURCE_DIR}/include/dlt\r
93     ${CMAKE_SOURCE_DIR}/src/shared/ \r
94     ${CMAKE_SOURCE_DIR}/src/lib/\r
95     ${CMAKE_SOURCE_DIR}/src/daemon/\r
96 )\r
97 \r
98 if(WITH_DLTTEST)\r
99         add_definitions( -DDLT_TEST_ENABLE)\r
100 endif(WITH_DLTTEST)\r
101 \r
102 if(WITH_DLT_SHM_ENABLE)\r
103     add_definitions( -DDLT_SHM_ENABLE)\r
104 endif(WITH_DLT_SHM_ENABLE)\r
105    \r
106 if(WITH_GPROF)
107   SET(CMAKE_C_FLAGS "-pg")
108 endif(WITH_GPROF)   \r
109    \r
110 add_definitions( "-Wall" )\r
111 \r
112 add_subdirectory( cmake )\r
113 \r
114 message( STATUS )\r
115 message( STATUS "-------------------------------------------------------------------------------" )\r
116 message( STATUS "Build for Version ${DLT_VERSION} build ${DLT_REVISION} version state ${DLT_VERSION_STATE}")\r
117 message( STATUS "WITH_DLT_SHM_ENABLE = ${WITH_DLT_SHM_ENABLE}" )\r
118 message( STATUS "WITH_CHECK_CONFIG_FILE = ${WITH_CHECK_CONFIG_FILE}" )\r
119 message( STATUS "WITH_DOC = ${WITH_DOC}" )\r
120 message( STATUS "WITH_TESTSCRIPTS = ${WITH_TESTSCRIPTS}" )\r
121 message( STATUS "WITH_SYSTEMD = ${WITH_SYSTEMD}" )\r
122 message( STATUS "WITH_GPROF = ${WITH_GPROF}" )\r
123 message( STATUS "WITH_MAN = ${WITH_MAN}" )\r
124 message( STATUS "WITH_DLTTEST = ${WITH_DLTTEST}" )\r
125 message( STATUS "BUILD_SHARED_LIBS = ${BUILD_SHARED_LIBS}" )\r
126 message( STATUS "CMAKE_INSTALL_PREFIX = ${CMAKE_INSTALL_PREFIX}" )\r
127 message( STATUS "CMAKE_BUILD_TYPE = ${CMAKE_BUILD_TYPE}" )\r
128 message( STATUS "Change a value with: cmake -D<Variable>=<Value>" )\r
129 message( STATUS "-------------------------------------------------------------------------------" )\r
130 message( STATUS )\r
131 \r
132 configure_file(${CMAKE_SOURCE_DIR}/${PROJECT_NAME}.spec.in ${PROJECT_BINARY_DIR}/${PROJECT_NAME}.spec)\r
133 configure_file(${CMAKE_SOURCE_DIR}/${PROJECT_NAME}.pc.in ${PROJECT_BINARY_DIR}/${PROJECT_NAME}.pc @ONLY)\r
134 install(FILES ${PROJECT_BINARY_DIR}/${PROJECT_NAME}.pc DESTINATION lib/pkgconfig COMPONENT devel)\r
135 \r
136 add_subdirectory( doc )\r
137 add_subdirectory( src )\r
138 add_subdirectory( include )\r
139 add_subdirectory( testscripts )\r
140 add_subdirectory( systemd )\r