2 # Dlt - Diagnostic Log and Trace
\r
3 # @licence make begin@
\r
5 # Copyright (C) 2011, BMW AG - Alexander Wenzel <alexander.wenzel@bmw.de>
\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
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
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
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
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
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
38 cmake_minimum_required( VERSION 2.6 )
\r
39 project( automotive-dlt )
\r
41 mark_as_advanced( CMAKE_BACKWARDS_COMPATIBILITY)
\r
42 set( CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS TRUE )
\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 0)
\r
48 set( DLT_VERSION ${DLT_MAJOR_VERSION}.${DLT_MINOR_VERSION}.${DLT_PATCH_LEVEL})
\r
49 set( DLT_VERSION_STATE BETA )
\r
50 set( DLT_REVISION "")
\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
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
69 message(STATUS "Build type not defined. Using default build type 'RelWithDebInfo'.")
\r
70 endif(NOT CMAKE_BUILD_TYPE)
\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
83 set( GENIVI_RPM_RELEASE "1")#${DLT_REVISION}")
\r
84 set( LICENSE "LGPL v2.1 with special exception" )
\r
86 # Build, project and include settings
\r
87 find_package(Threads REQUIRED)
\r
89 include_directories(
\r
90 ${CMAKE_SOURCE_DIR}/
\r
91 ${CMAKE_SOURCE_DIR}/include/dlt
\r
92 ${CMAKE_SOURCE_DIR}/src/shared/
\r
93 ${CMAKE_SOURCE_DIR}/src/lib/
\r
94 ${CMAKE_SOURCE_DIR}/src/daemon/
\r
97 if(WITH_DLT_SHM_ENABLE)
\r
98 add_definitions( -DDLT_SHM_ENABLE)
\r
99 endif(WITH_DLT_SHM_ENABLE)
\r
102 SET(CMAKE_C_FLAGS "-pg")
105 add_definitions( "-Wall" )
\r
107 add_subdirectory( cmake )
\r
110 message( STATUS "-------------------------------------------------------------------------------" )
\r
111 message( STATUS "Build for Version ${DLT_VERSION} build ${DLT_REVISION} version state ${DLT_VERSION_STATE}")
\r
112 message( STATUS "WITH_DLT_SHM_ENABLE = ${WITH_DLT_SHM_ENABLE}" )
\r
113 message( STATUS "WITH_CHECK_CONFIG_FILE = ${WITH_CHECK_CONFIG_FILE}" )
\r
114 message( STATUS "WITH_DOC = ${WITH_DOC}" )
\r
115 message( STATUS "WITH_TESTSCRIPTS = ${WITH_TESTSCRIPTS}" )
\r
116 message( STATUS "WITH_SYSTEMD = ${WITH_SYSTEMD}" )
\r
117 message( STATUS "WITH_GPROF = ${WITH_GPROF}" )
\r
118 message( STATUS "WITH_MAN = ${WITH_MAN}" )
\r
119 message( STATUS "BUILD_SHARED_LIBS = ${BUILD_SHARED_LIBS}" )
\r
120 message( STATUS "CMAKE_INSTALL_PREFIX = ${CMAKE_INSTALL_PREFIX}" )
\r
121 message( STATUS "CMAKE_BUILD_TYPE = ${CMAKE_BUILD_TYPE}" )
\r
122 message( STATUS "Change a value with: cmake -D<Variable>=<Value>" )
\r
123 message( STATUS "-------------------------------------------------------------------------------" )
\r
126 configure_file(${CMAKE_SOURCE_DIR}/${PROJECT_NAME}.spec.in ${PROJECT_BINARY_DIR}/${PROJECT_NAME}.spec)
\r
127 configure_file(${CMAKE_SOURCE_DIR}/${PROJECT_NAME}.pc.in ${PROJECT_BINARY_DIR}/${PROJECT_NAME}.pc @ONLY)
\r
128 install(FILES ${PROJECT_BINARY_DIR}/${PROJECT_NAME}.pc DESTINATION lib/pkgconfig COMPONENT devel)
\r
130 add_subdirectory( doc )
\r
131 add_subdirectory( src )
\r
132 add_subdirectory( include )
\r
133 add_subdirectory( testscripts )
\r
134 add_subdirectory( systemd )