-
Notifications
You must be signed in to change notification settings - Fork 2
/
CMakeLists.txt
122 lines (90 loc) · 2.78 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
cmake_minimum_required(VERSION 2.6)
set(PACKAGE SomeIP)
PROJECT(${PACKAGE})
SET( ${PROJECT_NAME}_MAJOR_VERSION 0 )
SET( ${PROJECT_NAME}_MINOR_VERSION 10 )
SET( ${PROJECT_NAME}_PATCH_LEVEL 1 )
set(VERSION ${${PROJECT_NAME}_MAJOR_VERSION}.${${PROJECT_NAME}_MINOR_VERSION}.${${PROJECT_NAME}_PATCH_LEVEL})
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -std=c++11")
if (USE_LIBCPP)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++")
set(CPP_LIBS c++)
endif()
#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pedantic -Wextra")
find_package(IVILogging REQUIRED)
set(LOGGING_LIBRARIES ${IVILOGGING_LIBRARIES})
# Dependencies
FIND_PACKAGE(PkgConfig REQUIRED)
pkg_check_modules(GLIB REQUIRED glib-2.0)
add_definitions(${GLIB_CFLAGS})
include_directories(
utilLib
lib
${CMAKE_CURRENT_BINARY_DIR}/lib
ipc
clientLib
)
include_directories(
${CMAKE_CURRENT_SOURCE_DIR}
)
link_directories(
${COMMONAPI_LIBRARY_DIRS}
${GLIB_LIBRARY_DIRS}
)
#configure_file(CommonAPI-SomeIP.pc.in CommonAPI-SomeIP.pc @ONLY)
#install(FILES ${CMAKE_CURRENT_BINARY_DIR}/CommonAPI-SomeIP.pc DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/pkgconfig)
set(DEVELOPMENT_INCLUDE_PATH " -I${CMAKE_CURRENT_BINARY_DIR}/lib -I${CMAKE_CURRENT_SOURCE_DIR} -I${CMAKE_CURRENT_SOURCE_DIR}/clientLib -I${CMAKE_CURRENT_SOURCE_DIR}/utilLib -I${CMAKE_CURRENT_SOURCE_DIR}/lib -I${CMAKE_CURRENT_SOURCE_DIR}/common-api/include #")
set(DEVELOPMENT_LIBRARY_PATH " -L${CMAKE_CURRENT_BINARY_DIR}/clientLib -L${CMAKE_CURRENT_BINARY_DIR}/lib #" )
if (ENABLE_SYSTEMD)
add_definitions(-DENABLE_SYSTEMD)
pkg_check_modules(GLIB_DBUS REQUIRED dbus-glib-1)
add_definitions(${GLIB_DBUS_CFLAGS})
IF(${CMAKE_INSTALL_PREFIX} STREQUAL "/usr")
set(SYSTEMD_CONFIGURATION_FILES_DIR "/lib/systemd/system")
ELSE()
set(SYSTEMD_CONFIGURATION_FILES_DIR "systemd/system")
ENDIF()
endif()
set(PUBLIC_HEADERS_LOCATION include/someip/lib)
add_subdirectory (daemon)
add_subdirectory (tools)
add_subdirectory (lib)
add_subdirectory (clientLib)
add_subdirectory (utilLib)
OPTION( ENABLE_TEST "Enable testing" OFF)
if (ENABLE_TEST)
include( CTest )
macro(add_gtest_test testName files libraries)
if (NOT DEFINED GTEST_DIR)
set(GTEST_DIR $ENV{GTEST_DIR})
endif()
if (DEFINED GTEST_DIR)
message("Google test found in ${GTEST_DIR}")
include_directories(${GTEST_DIR}/include)
link_directories(${GTEST_DIR}/lib/.libs)
add_executable(${testName}
${files}
)
target_link_libraries(${testName}
gtest
${libraries}
)
INSTALL(TARGETS ${testName}
DESTINATION bin/test
)
add_test(
NAME ${testName}
COMMAND ${testName}
)
else()
message("Google test not found")
endif()
endmacro()
enable_testing()
add_subdirectory(test)
endif()
if (ENABLE_DOC)
add_subdirectory (doc)
endif()
if (ENABLE_EXAMPLES)
endif()