-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
86 lines (71 loc) · 2.33 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
# Set cmake version requirement
cmake_minimum_required(VERSION 3.14)
project(CANTool)
# Compiler options
set(CMAKE_CXX_STANDARD 17)
#set(CMAKE_CXX_FLAGS "-pthread")
include_directories("${CMAKE_CURRENT_SOURCE_DIR}/source")
include_directories("$ENV{LIBRARIES_PATH}/gtest/include")
link_directories("$ENV{LIBRARIES_PATH}/gtest/lib")
# -------------------------------------------------
# CAN Interfaces
# -------------------------------------------------
set(SOURCES_INTERFACES
# Generic CAN Interface
source/interfaces/include/ICANInterface.h
# Interface factory
source/interfaces/include/connection_factory.h
source/interfaces/src/connection_factory.cpp
# CAN Socket
source/interfaces/include/CANSocket.h
source/interfaces/src/CANSocket.cpp
)
# -------------------------------------------------
# General CAN utilities, including protocols
# -------------------------------------------------
set(SOURCES_CAN_UTILITY
# CAN Message
source/can/include/Message.h
source/can/src/Message.cpp
# CANOpen protocol
source/can/include/canopen.h
)
# -------------------------------------------------
# Other utilities
# -------------------------------------------------
set(SOURCES_UTILITY
# Commandline arguments parser
source/utility/include/cmdargs_parser.h
source/utility/src/cmdargs_parser.cpp
)
# -------------------------------------------------
# Sources for targets
# -------------------------------------------------
set(SOURCES_TARGET_CANLIB
${SOURCES_INTERFACES}
${SOURCES_CAN_UTILITY}
# Include the utilities here, although they are not directly CAN-related
${SOURCES_UTILITY}
)
set(SOURCES_TARGET_CANTOOL
# Main entry point
source/main.cpp
)
# -------------------------------------------------
# Tests
# -------------------------------------------------
set(SOURCES_TARGET_TESTS
tests/test_main.cpp
tests/canopen/canopen_tests.cpp
tests/connection_factory_tests.cpp
tests/cmdargs_parser_tests.cpp
)
# -------------------------------------------------
# Build targets
# -------------------------------------------------
add_library(canlib STATIC ${SOURCES_TARGET_CANLIB})
add_executable(cantool ${SOURCES_TARGET_CANTOOL})
target_link_libraries(cantool canlib)
# The tests
add_executable(tests ${SOURCES_TARGET_TESTS})
target_link_libraries(tests gtest canlib)