* [GAM-56] fix
[profile/ivi/genivi/genivi-audio-manager.git] / PluginCommandInterfaceDbus / CMakeLists.txt
1 # Copyright (c) 2012 BMW
2 #
3 # author Christian Mueller, christian.ei.mueller@bmw.de BMW 2011,2012
4 #
5 # copyright
6 # Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction,
7 # including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
8 # subject to the following conditions:
9 # The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
10 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
11 # IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
12 # THE USE OR OTHER DEALINGS IN THE SOFTWARE.
13 #
14 # For further information see http://www.genivi.org/.
15 #
16
17 cmake_minimum_required(VERSION 2.6)
18
19 PROJECT(PluginCommandInterfaceDbus)
20
21 set(LIBRARY_OUTPUT_PATH ${PLUGINS_OUTPUT_PATH}/command)
22 set(DOC_OUTPUT_PATH ${DOC_OUTPUT_PATH}/CommandDBusPlugin)
23 set(INCLUDE_FOLDER "include")
24
25 FILE(READ "${AUDIO_INCLUDE_FOLDER}/command/IAmCommandSend.h" VERSION_BUFFER LIMIT 6000)
26 STRING(REGEX MATCH "CommandSendVersion*.[^0-9]*[0-9].[0-9]*[0-9]" LIB_INTERFACE_VERSION_STRING ${VERSION_BUFFER})
27 STRING(REGEX REPLACE "CommandSendVersion*.." "" LIB_INTERFACE_VERSION ${LIB_INTERFACE_VERSION_STRING})
28 MESSAGE(STATUS "Building against command interface version ${LIB_INTERFACE_VERSION}")
29
30 FIND_PACKAGE(DBUS REQUIRED)
31
32 INCLUDE_DIRECTORIES(
33         ${CMAKE_SOURCE_DIR} 
34         ${CMAKE_CURRENT_BINARY_DIR}
35         ${DBUS_INCLUDE_DIR}
36         ${DBUS_ARCH_INCLUDE_DIR}
37         ${AUDIO_INCLUDE_FOLDER}
38         ${PROJECT_INCLUDE_FOLDER}
39         ${DLT_INCLUDE_DIRS}
40         ${INCLUDE_FOLDER}
41 )
42
43 # all source files go here
44 file(GLOB PLUGINDBUS_SRCS_CXX "src/*.cpp")
45
46 add_library(PluginCommandInterfaceDbus SHARED ${PLUGINDBUS_SRCS_CXX})
47
48 SET_TARGET_PROPERTIES(PluginCommandInterfaceDbus PROPERTIES 
49                                             SOVERSION "${LIB_INTERFACE_VERSION}"
50 )
51
52 TARGET_LINK_LIBRARIES(PluginCommandInterfaceDbus 
53     ${DLT_LIBRARIES}
54     ${DBUS_LIBRARY}
55 )
56
57 IF(WITH_TESTS)
58         add_subdirectory (test)
59 ENDIF(WITH_TESTS)
60
61 #IF(WITH_DOCUMENTATION)
62 #       file(MAKE_DIRECTORY ${DOC_OUTPUT_PATH})
63 #       configure_file(${DOXY_FILE}  ${DOC_OUTPUT_PATH}/Doxyfile  @ONLY IMMEDIATE)
64 #       add_custom_target (PluginInterfaceDBusDocs ALL 
65 #               COMMAND ${DOXYGEN_EXECUTABLE} ${DOC_OUTPUT_PATH}/Doxyfile WORKING_DIRECTORY ${DOC_OUTPUT_PATH}
66 #               SOURCES ${PROJECT_BINARY_DIR} ${DOC_OUTPUT_PATH}/Doxyfile
67 #       )
68 #ENDIF(WITH_DOCUMENTATION)
69
70 INSTALL(TARGETS PluginCommandInterfaceDbus 
71         DESTINATION "lib/${LIB_INSTALL_SUFFIX}/command"
72         PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ GROUP_EXECUTE GROUP_READ WORLD_EXECUTE WORLD_READ
73         COMPONENT sampleplugins
74 )
75
76 execute_process(COMMAND cp "${CMAKE_SOURCE_DIR}/PluginCommandInterfaceDbus/${INCLUDE_FOLDER}/CommandInterface.xml" ${EXECUTABLE_OUTPUT_PATH}/CommandInterface.xml)
77
78 SET(ADD_DEPEND "audiomanager-bin" "dlt" "libdbus-1-3(>=1.2.16)")
79 set_property(GLOBAL APPEND PROPERTY sampleplugins_prop "${ADD_DEPEND}")