23a0684270751f0e346a6b7f2a6ea10f014aa3e2
[profile/ivi/automotive-message-broker.git] / plugins / cangenplugin / test / CMakeLists.txt
1
2 set(include_dirs ${CMAKE_CURRENT_SOURCE_DIR}/lib ${CMAKE_SOURCE_DIR}/lib ../ ../../../tests)
3
4 find_library(libtool_LIBRARY ltdl DOC "Libtool libraries")
5 find_path(libtool_INCLUDE_DIR ltdl.h DOC "Libtool headers")
6
7 pkg_check_modules(glib REQUIRED glib-2.0)
8 pkg_check_modules(json REQUIRED json-c)
9 pkg_check_modules(websockets REQUIRED libwebsockets)
10
11 #find libcanbus.a library:
12 find_library(canbus_LIBRARY canbus PATHS $ENV{IVIPOC_HOME}/native/lib DOC "canbus library")
13 if(canbus_LIBRARY)
14      message(STATUS "canbus library found")
15 else(canbus_LIBRARY)
16      message(FATAL_ERROR "canbus library is missing. please install or build canbus")
17 endif(canbus_LIBRARY)
18
19 #find libivipoc-common.a library:
20 find_library(ivipoc-common_LIBRARY ivipoc-common PATHS $ENV{IVIPOC_HOME}/native/lib DOC "ivipoc-common library")
21 if(ivipoc-common_LIBRARY)
22      message(STATUS "ivipoc-common library found")
23 else(ivipoc-common_LIBRARY)
24      message(FATAL_ERROR "ivipoc-common library is missing. please install or build canbus")
25 endif(ivipoc-common_LIBRARY)
26
27 #find canbus headers:
28 find_path(canbus_INCLUDE_DIR canbus.h canobserver.h logger.h mutex.h thread.h
29     PATHS $ENV{IVIPOC_HOME}/native/include
30     DOC "canbus headers")
31
32 if(canbus_INCLUDE_DIR)
33     message(STATUS "canbus headers found.")
34 else(canbus_INCLUDE_DIR)
35     message(FATAL_ERROR "no canbus headers found")
36 endif(canbus_INCLUDE_DIR)
37
38 set(ut_cangenplugin_headers cangenplugin.h websockets.h mockabstractroutingengine.h)
39 set(ut_cangenplugin_sources main.cpp ut_cangenplugin.cpp ../cangenplugin.cpp ../websockets.cpp)
40
41 SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++0x")
42 add_definitions(-fPIC -g)
43
44 add_executable(ut_cangenplugin ${ut_cangenplugin_sources})
45
46 include_directories(${include_dirs} ../ivipocbase ${libtool_INCLUDE_DIR} ${canbus_INCLUDE_DIR} ${glib_INCLUDE_DIRS} ${gio_INCLUDE_DIRS})
47 target_link_libraries(ut_cangenplugin ${link_libraries} ivipocbase -L${CMAKE_CURRENT_BINARY_DIR}/../../../ivipocbase/build ${libtool_LIBRARY} ${glib_LIBRARIES} ${json_LIBRARIES} amb ${websockets_LIBRARIES} ${canbus_LIBRARY} ${ivipoc-common_LIBRARY} -lgobject-2.0 -lpthread)
48