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

Commit

Permalink
Support Botan-2 (>= 2.2.0). Fix #104
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
librehat committed Aug 2, 2017
1 parent 1843683 commit 440c435
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 6 deletions.
11 changes: 10 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ project(QtShadowsocks
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")
Expand All @@ -18,7 +19,15 @@ set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
find_package(Qt5Core)
find_package(Qt5Network)
find_package(PkgConfig)
pkg_search_module(BOTAN REQUIRED botan-1.10 botan-2)

if (USE_BOTAN2)
pkg_check_modules(BOTAN REQUIRED botan-2>=2.2.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(NOT BUILD_SHARED_LIBS)
add_definitions(-DQSS_STATIC)
Expand Down
2 changes: 1 addition & 1 deletion lib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ add_library(${LIBNAME} ${SOURCE})
target_link_libraries(${LIBNAME}
PUBLIC Qt5::Core
PUBLIC Qt5::Network
PRIVATE ${BOTAN_LIBRARIES})
PRIVATE ${BOTAN_LIBRARY_VAR})
target_include_directories(${LIBNAME} PRIVATE ${BOTAN_INCLUDE_DIRS})

foreach(LIB Qt5Network Qt5Core ${BOTAN_LIBRARIES})
Expand Down
3 changes: 1 addition & 2 deletions shadowsocks-libqss/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,8 @@ set(SOURCE

add_executable(${TASK} ${SOURCE})

target_link_libraries(${TASK} Qt5::Core Qt5::Network ${BOTAN_LIBRARIES} QtShadowsocks)
target_link_libraries(${TASK} Qt5::Core Qt5::Network QtShadowsocks)
target_include_directories(${TASK}
PUBLIC ${BOTAN_INCLUDE_DIRS}
PUBLIC ${PROJECT_SOURCE_DIR}/lib)

install(TARGETS ${TASK} RUNTIME DESTINATION bin)
3 changes: 1 addition & 2 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ set(SOURCE
add_executable(${TASK} ${SOURCE})

find_package(Qt5Test)
target_link_libraries(${TASK} Qt5::Core Qt5::Network Qt5::Test ${BOTAN_LIBRARIES} QtShadowsocks)
target_link_libraries(${TASK} Qt5::Core Qt5::Network Qt5::Test QtShadowsocks)
target_include_directories(${TASK}
PUBLIC ${BOTAN_INCLUDE_DIRS}
PUBLIC ${PROJECT_SOURCE_DIR}/lib)

0 comments on commit 440c435

Please sign in to comment.