This repository was archived by the owner on Dec 10, 2019. It is now read-only.
File tree Expand file tree Collapse file tree 4 files changed +13
-6
lines changed Expand file tree Collapse file tree 4 files changed +13
-6
lines changed Original file line number Diff line number Diff line change @@ -5,6 +5,7 @@ project(QtShadowsocks
55 LANGUAGES CXX)
66
77option (BUILD_SHARED_LIBS "Build ${PROJECT_NAME} as a shared library" ON )
8+ option (USE_BOTAN2 "Build ${PROJECT_NAME} with Botan-2" OFF )
89
910set (LIB_INSTALL_DIR ${CMAKE_INSTALL_PREFIX} /lib
1011 CACHE PATH "Installation directory for libraries" )
@@ -18,7 +19,15 @@ set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
1819find_package (Qt5Core)
1920find_package (Qt5Network)
2021find_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
2332if (NOT BUILD_SHARED_LIBS )
2433 add_definitions (-DQSS_STATIC)
Original file line number Diff line number Diff line change @@ -46,7 +46,7 @@ add_library(${LIBNAME} ${SOURCE})
4646target_link_libraries (${LIBNAME}
4747 PUBLIC Qt5::Core
4848 PUBLIC Qt5::Network
49- PRIVATE ${BOTAN_LIBRARIES } )
49+ PRIVATE ${BOTAN_LIBRARY_VAR } )
5050target_include_directories (${LIBNAME} PRIVATE ${BOTAN_INCLUDE_DIRS} )
5151
5252foreach (LIB Qt5Network Qt5Core ${BOTAN_LIBRARIES} )
Original file line number Diff line number Diff line change @@ -8,9 +8,8 @@ set(SOURCE
88
99add_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)
1212target_include_directories (${TASK}
13- PUBLIC ${BOTAN_INCLUDE_DIRS}
1413 PUBLIC ${PROJECT_SOURCE_DIR} /lib)
1514
1615install (TARGETS ${TASK} RUNTIME DESTINATION bin)
Original file line number Diff line number Diff line change @@ -12,7 +12,6 @@ set(SOURCE
1212add_executable (${TASK} ${SOURCE} )
1313
1414find_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)
1616target_include_directories (${TASK}
17- PUBLIC ${BOTAN_INCLUDE_DIRS}
1817 PUBLIC ${PROJECT_SOURCE_DIR} /lib)
You can’t perform that action at this time.
0 commit comments