forked from linux-can/can-utils
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
57 lines (45 loc) · 1.55 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
cmake_minimum_required(VERSION 3.3)
project(can-utils LANGUAGES C)
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release)
endif()
if ("${CMAKE_C_COMPILER_ID}" STREQUAL "GNU")
add_definitions(-D_GNU_SOURCE)
endif()
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wno-parentheses")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fno-strict-aliasing")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DSO_RXQ_OVFL=40")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DPF_CAN=29")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DAF_CAN=PF_CAN")
include_directories (.)
include_directories (./include)
set(PROGRAMS_ISOTP isotpdump isotprecv isotpsend isotpsniffer
isotptun isotpserver isotpperf)
set(PROGRAMS_CANGW cangw)
set(PROGRAMS_SLCAN slcan_attach slcand)
set(PROGRAMS_J1939 jacd jspy jsr testj1939)
set(PROGRAMS_CANLIB cansend cangen candump canplayer canlogserver
canbusload log2long log2asc asc2log)
set(PROGRAMS can-calc-bit-timing cansniffer bcmserver
${PROGRAMS_CANLIB}
${PROGRAMS_ISOTP}
${PROGRAMS_CANGW}
${PROGRAMS_SLCAN}
slcanpty canfdtest
)
if(NOT ANDROID)
list(APPEND PROGRAMS ${PROGRAMS_J1939})
endif()
foreach(name ${PROGRAMS})
set(SRC_DEPS)
if("${name}" STREQUAL "canbusload")
set(SRC_DEPS canframelen.c)
elseif("${name}" IN_LIST PROGRAMS_J1939)
set(SRC_DEPS libj1939.c)
elseif("${name}" IN_LIST PROGRAMS_CANLIB)
set(SRC_DEPS lib.c)
endif()
add_executable(${name} ${name}.c ${SRC_DEPS})
install(TARGETS ${name} DESTINATION ${CMAKE_INSTALL_PREFIX}/bin)
endforeach()
ADD_CUSTOM_TARGET(uninstall "${CMAKE_COMMAND}" -P "${CMAKE_SOURCE_DIR}/cmake/make_uninstall.cmake")