Skip to content
This repository was archived by the owner on Dec 10, 2019. It is now read-only.

Commit 440c435

Browse files
committed
Support Botan-2 (>= 2.2.0). Fix #104
Botan-2 2.2.0 has not been released yet. I've tested with their `master` branch code and verified that the issue #104 is resolved.
1 parent 1843683 commit 440c435

File tree

4 files changed

+13
-6
lines changed

4 files changed

+13
-6
lines changed

CMakeLists.txt

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ project(QtShadowsocks
55
LANGUAGES CXX)
66

77
option(BUILD_SHARED_LIBS "Build ${PROJECT_NAME} as a shared library" ON)
8+
option(USE_BOTAN2 "Build ${PROJECT_NAME} with Botan-2" OFF)
89

910
set(LIB_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/lib
1011
CACHE PATH "Installation directory for libraries")
@@ -18,7 +19,15 @@ set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
1819
find_package(Qt5Core)
1920
find_package(Qt5Network)
2021
find_package(PkgConfig)
21-
pkg_search_module(BOTAN REQUIRED botan-1.10 botan-2)
22+
23+
if (USE_BOTAN2)
24+
pkg_check_modules(BOTAN REQUIRED botan-2>=2.2.0)
25+
else()
26+
pkg_check_modules(BOTAN REQUIRED botan-1.10)
27+
endif()
28+
find_library(BOTAN_LIBRARY_VAR
29+
NAMES ${BOTAN_LIBRARIES}
30+
HINTS ${BOTAN_LIBRARY_DIRS} ${BOTAN_LIBDIR})
2231

2332
if(NOT BUILD_SHARED_LIBS)
2433
add_definitions(-DQSS_STATIC)

lib/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ add_library(${LIBNAME} ${SOURCE})
4646
target_link_libraries(${LIBNAME}
4747
PUBLIC Qt5::Core
4848
PUBLIC Qt5::Network
49-
PRIVATE ${BOTAN_LIBRARIES})
49+
PRIVATE ${BOTAN_LIBRARY_VAR})
5050
target_include_directories(${LIBNAME} PRIVATE ${BOTAN_INCLUDE_DIRS})
5151

5252
foreach(LIB Qt5Network Qt5Core ${BOTAN_LIBRARIES})

shadowsocks-libqss/CMakeLists.txt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,8 @@ set(SOURCE
88

99
add_executable(${TASK} ${SOURCE})
1010

11-
target_link_libraries(${TASK} Qt5::Core Qt5::Network ${BOTAN_LIBRARIES} QtShadowsocks)
11+
target_link_libraries(${TASK} Qt5::Core Qt5::Network QtShadowsocks)
1212
target_include_directories(${TASK}
13-
PUBLIC ${BOTAN_INCLUDE_DIRS}
1413
PUBLIC ${PROJECT_SOURCE_DIR}/lib)
1514

1615
install(TARGETS ${TASK} RUNTIME DESTINATION bin)

test/CMakeLists.txt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ set(SOURCE
1212
add_executable(${TASK} ${SOURCE})
1313

1414
find_package(Qt5Test)
15-
target_link_libraries(${TASK} Qt5::Core Qt5::Network Qt5::Test ${BOTAN_LIBRARIES} QtShadowsocks)
15+
target_link_libraries(${TASK} Qt5::Core Qt5::Network Qt5::Test QtShadowsocks)
1616
target_include_directories(${TASK}
17-
PUBLIC ${BOTAN_INCLUDE_DIRS}
1817
PUBLIC ${PROJECT_SOURCE_DIR}/lib)

0 commit comments

Comments
 (0)