forked from shadowsocks/libQtShadowsocks
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
51 lines (43 loc) · 1.64 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
cmake_minimum_required(VERSION 3.1)
project(QtShadowsocks
VERSION 2.0.0
LANGUAGES CXX)
option(BUILD_SHARED_LIBS "Build ${PROJECT_NAME} as a shared library" ON)
option(USE_BOTAN2 "Build ${PROJECT_NAME} with Botan-2" OFF)
set(LIB_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/lib
CACHE PATH "Installation directory for libraries")
set(INCLUDE_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/include
CACHE PATH "Installation directory for headers")
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
find_package(Qt5Core 5.5)
find_package(Qt5Network 5.5)
find_package(PkgConfig)
if (USE_BOTAN2)
add_definitions(-DUSE_BOTAN2)
pkg_check_modules(BOTAN REQUIRED botan-2>=2.3.0)
else()
pkg_check_modules(BOTAN REQUIRED botan-1.10)
endif()
find_library(BOTAN_LIBRARY_VAR
NAMES ${BOTAN_LIBRARIES}
HINTS ${BOTAN_LIBRARY_DIRS} ${BOTAN_LIBDIR})
if(BUILD_SHARED_LIBS)
add_definitions(-DQSS_LIBRARY)
else()
add_definitions(-DQSS_STATIC)
if (MINGW)
# This however doesn't fix the problem that the executables are depending on the GCC shared libraries
# I can't find a solution in CMake so far. The workaround is to manually append "-l:libgcc.a -l:libstdc++.a -l:libwinpthread.a" to the end of executables' linklibs.rsp files (in CMakeFiles directory)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static-libgcc -static-libstdc++")
endif()
endif()
if(WIN32 OR APPLE)
add_definitions(-DFD_SETSIZE=1024)
endif()
add_subdirectory(lib)
add_subdirectory(shadowsocks-libqss)
add_subdirectory(test)