1
0
mirror of https://github.com/SoftEtherVPN/SoftEtherVPN.git synced 2024-11-22 17:39:53 +03:00

cmake: lib cleanup and use cmake package_find

* use OPENSSL_ROOT_DIR
* add special .configure handling for osx
* move readline, curses to cedar

Signed-off-by: Andy Walsh <andy.walsh44+github@gmail.com>
This commit is contained in:
Andy Walsh 2018-07-31 11:49:55 +02:00
parent ce5ee2b070
commit 0bbf08fea7
6 changed files with 19 additions and 19 deletions

View File

@ -48,6 +48,7 @@ before_install:
- bash .ci/build-openssl.sh > build-deps.log 2>&1 || (cat build-deps.log && exit 1) - bash .ci/build-openssl.sh > build-deps.log 2>&1 || (cat build-deps.log && exit 1)
script: script:
- export OPENSSL_ROOT_DIR=${OPENSSL_INSTALL_DIR}
- export LD_LIBRARY_PATH="${HOME}/opt/lib:${LD_LIBRARY_PATH:-}" - export LD_LIBRARY_PATH="${HOME}/opt/lib:${LD_LIBRARY_PATH:-}"
- export CFLAGS="-I${HOME}/opt/include" - export CFLAGS="-I${HOME}/opt/include"
- export LDFLAGS="-L${HOME}/opt/lib" - export LDFLAGS="-L${HOME}/opt/lib"

View File

@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.0) cmake_minimum_required(VERSION 3.4.3)
project(SoftEtherVPN LANGUAGES C) project(SoftEtherVPN LANGUAGES C)

8
configure vendored
View File

@ -25,6 +25,14 @@ if [ ! -z ${CMAKE_INSTALL_PREFIX+x} ]; then
CMAKE_FLAGS="-DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX}" CMAKE_FLAGS="-DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX}"
fi fi
if [ -z ${OPENSSL_ROOT_DIR} ]; then
unameOut="$(uname -s)"
if [ "$unameOut" = "Darwin" ]; then
echo "Environment variable OPENSSL_ROOT_DIR not set, using default Homebrew path: /usr/local/opt/openssl/"
export OPENSSL_ROOT_DIR="/usr/local/opt/openssl/"
fi
fi
(cd tmp && cmake ${CMAKE_FLAGS} .. || exit 1) (cd tmp && cmake ${CMAKE_FLAGS} .. || exit 1)

View File

@ -63,8 +63,6 @@ if(UNIX)
if(${CMAKE_SYSTEM_NAME} STREQUAL "Darwin") if(${CMAKE_SYSTEM_NAME} STREQUAL "Darwin")
add_definitions(-DUNIX_MACOS -DBRIDGE_PCAP) add_definitions(-DUNIX_MACOS -DBRIDGE_PCAP)
include_directories(SYSTEM /usr/local/opt/openssl/include)
link_directories(SYSTEM /usr/local/opt/openssl/lib)
endif() endif()
endif() endif()

View File

@ -10,6 +10,11 @@ set_target_properties(cedar
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_SOURCE_DIR}/tmp/Cedar" RUNTIME_OUTPUT_DIRECTORY "${CMAKE_SOURCE_DIR}/tmp/Cedar"
) )
find_library(LIB_READLINE readline)
find_package(Curses REQUIRED)
target_link_libraries(cedar ${LIB_READLINE} ${CURSES_LIBRARIES})
if(${CMAKE_SYSTEM_NAME} STREQUAL "Darwin") if(${CMAKE_SYSTEM_NAME} STREQUAL "Darwin")
target_link_libraries(cedar pcap) target_link_libraries(cedar pcap)
endif() endif()

View File

@ -12,26 +12,14 @@ set_target_properties(mayaqua
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_SOURCE_DIR}/tmp/Mayaqua" RUNTIME_OUTPUT_DIRECTORY "${CMAKE_SOURCE_DIR}/tmp/Mayaqua"
) )
find_package(Threads) find_package(OpenSSL REQUIRED)
find_library(LIB_READLINE readline) find_package(Threads REQUIRED)
find_library(LIB_NCURSES ncurses) find_package(ZLIB REQUIRED)
find_library(LIB_Z z)
# In some cases libiconv is not included in libc # In some cases libiconv is not included in libc
find_library(LIB_ICONV iconv) find_library(LIB_ICONV iconv)
# This is required in order to link to the correct OpenSSL library target_link_libraries(mayaqua OpenSSL::SSL OpenSSL::Crypto Threads::Threads ZLIB::ZLIB)
find_library(LIB_SSL
NAMES ssl
HINTS "/usr/local/opt/openssl/lib"
)
find_library(LIB_CRYPTO
NAMES crypto
HINTS "/usr/local/opt/openssl/lib"
)
target_link_libraries(mayaqua ${CMAKE_THREAD_LIBS_INIT} ${LIB_SSL} ${LIB_CRYPTO} ${LIB_READLINE} ${LIB_NCURSES} ${LIB_Z})
if(LIB_ICONV) if(LIB_ICONV)
target_link_libraries(mayaqua ${LIB_ICONV}) target_link_libraries(mayaqua ${LIB_ICONV})