-
Notifications
You must be signed in to change notification settings - Fork 4
/
CMakeLists.txt
80 lines (63 loc) · 2.12 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
cmake_minimum_required(VERSION 2.6)
project (HelloWorld)
#define Product versions
set (HelloWorld_VERSION_MAJOR 0)
set (HelloWorld_VERSION_MINOR 0)
set (HelloWorld_VERSION_REVISION 1)
set (HelloWorld_VERSION_TAG 1)
set (HelloWorldVersion "${HelloWorld_VERSION_MAJOR}.${HelloWorld_VERSION_MINOR}.${HelloWorld_VERSION_REVISION}.${HelloWorld_VERSION_TAG}")
#define Project Tree directories
set (MAIN_INC
inc/TutorialConfig.h
inc/logger/lib_logger.h
inc/filelog/lib_filelog.h
inc/sharedMem/lib_sharedMem.h
inc/signal/lib_signal.h
inc/nmeaparser/NmeaParser.h
inc/can/j1939.h
inc/main_app/io_mapping.h
inc/inout/InOutApp.h
inc/main_app/eeprom.h)
#define Sources, dlls and libs
set (STA_LIB logger filelog canj1939 fifo sharedmem signal inout nmeaparser ioutils)
set (MAIN_SRC src/main.cpp
src/eeprom.cpp)
if(NMEAPDEBUG)
#add definitions
add_definitions (-DNMEAP_DEBUG)
endif()
if(CANDATALOGGER)
#add definitions
add_definitions (-DCANDATALOGGER)
endif()
if(LOGDEBUG)
#add definitions
add_definitions (-DLOGDEBUG)
endif()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Werror -Wno-varargs -Wno-sign-compare")
if (CMAKE_BUILD_TYPE STREQUAL DEBUG)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pg -O3")
endif()
#Check if Boost is available on system
find_package(Boost 1.40.0 COMPONENTS date_time filesystem system)
if (NOT ${Boost_FOUND})
message( FATAL_ERROR "libboost-all-dev was not found : ${Boost_NOT_FOUND_MESSAGE}" )
else ()
include_directories(${Boost_INCLUDE_DIRS})
endif(NOT ${Boost_FOUND})
#add CMake components subdirectories
add_subdirectory(deps)
#include directory
include_directories("inc")
#compiling step
add_executable(HelloWorld ${MAIN_SRC} ${MAIN_INC} ${Boost_INCLUDE_DIRS})
#link step
target_link_libraries(HelloWorld ${STA_LIB} ${Boost_LIBRARIES} -lboost_system -lpthread -lrt)
enable_testing()
# creates the executable
add_executable(UnitTest auto_unit_test/MyTest.cpp)
# declares a test with our executable
add_test(NAME test1 COMMAND UnitTest)
#install step
install (TARGETS HelloWorld DESTINATION ${CMAKE_BINARY_DIR}/exe)