-
Notifications
You must be signed in to change notification settings - Fork 9
/
CMakeLists.txt
92 lines (72 loc) · 1.83 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
cmake_minimum_required(VERSION 3.0)
project(ZCANBus)
set(CMAKE_CXX_STANDARD 11)
# set(PEAK_WANTED true)
# set(KVASER_WANTED true)
# set(ZLG_WANTED true)
# set(ZLG2_WANTED true)
# set(PEAK_UNWANTED true)
# set(KVASER_UNWANTED true)
# set(ZLG_UNWANTED true)
# set(ZLG2_UNWANTED true)
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
set(_COMPILER_ARCHITECTURE x64)
endif(CMAKE_SIZEOF_VOID_P EQUAL 8)
if(MSVC)
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
endif()
set(CAN_FILE CANHandler.cpp)
set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR})
if(PEAK_WANTED)
set(PEAK_REQUIRED REQUIRED)
endif()
if(KVASER_WANTED)
set(KVASER_REQUIRED REQUIRED)
endif()
if(ZLG_WANTED)
set(ZLG_REQUIRED REQUIRED)
endif()
if(ZLG2_WANTED)
set(ZLG2_REQUIRED REQUIRED)
endif()
if(NOT PEAK_UNWANTED)
find_package(Peak ${PEAK_REQUIRED})
endif()
if(NOT KVASER_UNWANTED)
find_package(Kvaser ${KVASER_REQUIRED})
endif()
if(NOT ZLG_UNWANTED)
find_package(ZLG ${ZLG_REQUIRED})
endif()
if(NOT ZLG2_UNWANTED)
find_package(ZLG2 ${ZLG2_REQUIRED})
endif()
if(Peak_FOUND)
add_definitions(-DUSE_PEAK)
list(APPEND CAN_FILE CANPeak.cpp)
include_directories(${Peak_INCLUDE_DIR})
link_libraries(${Peak_LIBS})
endif()
if(Kvaser_FOUND)
add_definitions(-DUSE_KVASER)
list(APPEND CAN_FILE CANKvaser.cpp)
include_directories(${Kvaser_INCLUDE_DIR})
link_libraries(${Kvaser_LIBS})
endif()
if(ZLG_FOUND)
add_definitions(-DUSE_ZLG)
list(APPEND CAN_FILE CANZLG.cpp)
include_directories(${ZLG_INCLUDE_DIR})
link_libraries(${ZLG_LIBS})
endif()
if(ZLG2_FOUND)
add_definitions(-DUSE_ZLG2)
list(APPEND CAN_FILE CANZLG2.cpp)
include_directories(${ZLG2_INCLUDE_DIR})
link_libraries(${ZLG2_LIBS})
endif()
if(CMAKE_HOST_UNIX)
link_libraries(pthread)
endif(CMAKE_HOST_UNIX)
# set(CMAKE_DEBUG_POSTFIX _d)
add_library(${PROJECT_NAME} ${CAN_FILE})