forked from mlahmadix/Demo
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
72 lines (56 loc) · 1.82 KB
/
CMakeLists.txt
File metadata and controls
72 lines (56 loc) · 1.82 KB
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
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}")
#version configuration file
configure_file (
"inc/TutorialConfig.h.in"
"inc/TutorialConfig.h")
#define Project Tree directories
set (MAIN_INC
inc/TutorialConfig.h
inc/archive/lib_archive.h
inc/dynamic/lib_dynamic.h
inc/can/can_drv.h)
#define Sources, dlls and libs
set (DYN_LIB dynamic canj1939 fifo)
set (STA_LIB archive)
set (MAIN_SRC
src/main.cpp)
if(FILECREAT)
#add definitions
add_definitions (-DFILECREAT)
endif()
if(LOGDEBUG)
#add definitions
add_definitions (-DLOGDEBUG)
endif()
set_property(TARGET ${projectname} PROPERTY CXX_STANDARD 14)
set_property(TARGET ${projectname} PROPERTY CXX_EXTENSIONS OFF)
set_property(TARGET ${projectname} PROPERTY CXX_STANDARD_REQUIRED ON)
#Check if Boost is available on system
find_package(Boost 1.36.0)
if (NOT ${Boost_FOUND})
message( FATAL_ERROR "libboost-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 ${DYN_LIB} ${STA_LIB} ${Boost_LIBRARIES})
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)