-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathCMakeLists.txt
67 lines (49 loc) · 2.05 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
cmake_minimum_required (VERSION 2.8)
set (BRANCH_ROOT ${CMAKE_SOURCE_DIR})
get_filename_component(BRANCH_ROOT ${BRANCH_ROOT} ABSOLUTE)
set (PROCESS_DIR ${CMAKE_SOURCE_DIR})
get_filename_component(PROCESS_DIR ${PROCESS_DIR} ABSOLUTE)
set (BRANCH_NAME "trafficInspector")
#set(CMAKE_C_COMPILER /usr/bin/gcc-7)
#set(CMAKE_CXX_COMPILER /usr/bin/g++-7)
#==============================================================================
#Common Directories
set (DIRECTORIES ${CMAKE_CURRENT_SOURCE_DIR})
list (APPEND SRC_DIRECTORIES ${DIRECTORIES}/src
${DIRECTORIES}/src/Packets)
#Headers dir
set (INC_DIRECTORIES ${DIRECTORIES}
${DIRECTORIES}/include
${DIRECTORIES}/include/Packets
${DIRECTORIES}/include/Utils)
#==============================================================================
#Compile flags
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17 -O0 -g3 -fvar-tracking -MD -Wall -Wno-invalid-offsetof -std=c++1z -D__GXX_EXPERIMENTAL_CXX0X__ ")
#DEBUG option
list (APPEND DEFINES_ALL -DDEBUG)
#==============================================================================
# Libraries
find_library (LIB_PTHREAD pthread)
list (APPEND LIBS ${LIB_PTHREAD})
#==============================================================================
list(REMOVE_DUPLICATES INC_DIRECTORIES)
list(REMOVE_DUPLICATES SRC_DIRECTORIES)
list(REMOVE_DUPLICATES DEFINES_ALL)
add_definitions(${DEFINES_ALL})
foreach (_dir ${SRC_DIRECTORIES})
file(GLOB _src ${_dir}/*.cpp)
list(APPEND SRC_ALL ${_src})
file(GLOB _src ${_dir}/*.c)
list(APPEND SRC_ALL ${_src})
endforeach()
include_directories(${INC_DIRECTORIES})
include_directories(${CMAKE_SOURCE_DIR})
foreach (_lib ${LIBS})
message(${_lib})
endforeach()
#==============================================================================
# Setup project
set (PROC_NAME "trafficInspector")
add_executable(${PROC_NAME} ${SRC_ALL})
set_target_properties(${PROC_NAME} PROPERTIES LINKER_LANGUAGE CXX)
target_link_libraries(${PROC_NAME} ${LIBS})