-
Notifications
You must be signed in to change notification settings - Fork 18
/
CMakeLists.txt
67 lines (51 loc) · 1.63 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
cmake_minimum_required(VERSION 2.8 FATAL_ERROR)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}")
# check for c++11 with gcc
include(CheckCXXCompilerFlag)
CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11)
CHECK_CXX_COMPILER_FLAG("-std=c++0x" COMPILER_SUPPORTS_CXX0X)
if(COMPILER_SUPPORTS_CXX11)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
elseif(COMPILER_SUPPORTS_CXX0X)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
else()
message(STATUS "The compiler ${CMAKE_CXX_COMPILER} has no C++11 support. Please use a different C++ compiler.")
endif()
# enable warnings
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra")
# main library
find_package(Threads REQUIRED)
include_directories(lib)
add_library(sumo
lib/decode.cpp
lib/control.cpp
lib/common.cpp
lib/realtime.cpp
lib/image.cpp
)
target_link_libraries(sumo ${CMAKE_THREAD_LIBS_INIT})
if(UNIX AND NOT APPLE)
find_library(RT rt)
target_link_libraries(sumo ${RT})
endif()
# build analyzer only if PCAP was found
find_package(Pcap)
if(PCAP_FOUND)
add_executable(analyze analyze/network.cpp analyze/main.cpp)
target_link_libraries(analyze ${PCAP_LIBRARIES} sumo)
endif()
add_executable(test_sumo test/test.cpp)
target_link_libraries(test_sumo sumo)
# qsumo
set(CMAKE_AUTOMOC ON)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
#set(CMAKE_AUTOUIC ON) # works only with cmake >= 3.0
find_package(Qt4 COMPONENTS QtCore QtGui REQUIRED)
include(${QT_USE_FILE})
set(qsumo_SRCS qsumo/qsumo.cpp qsumo/sumo-widget.cpp)
QT4_WRAP_UI(ui_widget.h qsumo/widget.ui)
add_executable(qs ${qsumo_SRCS} ui_widget.h)
target_link_libraries(qs
${QT_LIBRARIES}
sumo
)