forked from linuxdeepin/dde-network-core
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
70 lines (55 loc) · 2.13 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
cmake_minimum_required(VERSION 3.7)
set(VERSION "2.0.4" CACHE STRING "define project version")
project(dde-network-core
VERSION ${VERSION}
DESCRIPTION "DDE Network Core"
HOMEPAGE_URL "https://github.com/linuxdeepin/dde-network-core"
LANGUAGES CXX C
)
# 增加安全编译参数
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fstack-protector-all")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fstack-protector-all")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -z relro -z now -z noexecstack -pie")
option(ENABLE_DEEPIN_NMQT "enable nmqt patch on deepin" OFF)
set(DDE-Network-Core_INCLUDE_DIRS "${CMAKE_SOURCE_DIR}/src")
set(DDE-Network-Core_LIBRARIES dde-network-core)
find_package(PkgConfig REQUIRED)
find_package(KF5NetworkManagerQt REQUIRED)
pkg_check_modules(LibNM REQUIRED IMPORTED_TARGET libnm)
include_directories(${LibNM_INCLUDE_DIRS})
pkg_check_modules(Gio REQUIRED gio-2.0)
include_directories(${Gio_INCLUDE_DIRS})
pkg_search_module(GLIB REQUIRED glib-2.0)
include_directories(${GLIB_INCLUDE_DIRS})
link_directories(${GLIB_LIBRARY_DIRS})
set(TRY_KF5_LIBRARIES
IMPORTED_LOCATION_DEBIAN
IMPORTED_LOCATION_NOCONFIG
)
if (NOT KF5_QT_LIBRARIES)
find_library(KF5_QT_LIBRARIES libKF5NetworkManagerQt.so)
endif()
find_package(Qt5 COMPONENTS Core Widgets DBus Network LinguistTools REQUIRED)
find_package(KF5NetworkManagerQt REQUIRED)
get_target_property(KF5_QT_INCLUDE_DIRS KF5::NetworkManagerQt INTERFACE_INCLUDE_DIRECTORIES)
if (QT_DEBUG)
message(" KF5_QT_INCLUDE_DIRS : " ${KF5_QT_INCLUDE_DIRS})
message(" GLIB_INCLUDE_DIRS :" ${GLIB_INCLUDE_DIRS})
message(" CMAKE_CURRENT_SOURCE_DIR: " ${CMAKE_CURRENT_SOURCE_DIR})
message(STATUS ${result})
endif()
if (ENABLE_DEEPIN_NMQT)
add_definitions(-DUSE_DEEPIN_NMQT)
endif()
message(STATUS DEEPIN_NMQT_TEST ": ${DEEPIN_NMQT_TEST}")
if (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
set(CMAKE_INSTALL_PREFIX "/usr")
endif()
add_subdirectory("src")
add_subdirectory("dcc-network-plugin")
add_subdirectory("tests")
add_subdirectory("example")
add_subdirectory("dock-network-plugin")
add_subdirectory("dss-network-plugin")
add_subdirectory("dss_example")
add_subdirectory("dock-example")