1
0
mirror of https://github.com/SoftEtherVPN/SoftEtherVPN.git synced 2024-11-22 09:29:52 +03:00

CMake: find OpenSSL and zlib on Windows like we do on UNIX

This allows the project to be built with the support of vcpkg.
This commit is contained in:
Davide Beatrici 2020-07-27 21:32:50 +02:00
parent b57a4b051b
commit 352ed759b2

View File

@ -16,54 +16,28 @@ set_target_properties(mayaqua
RUNTIME_OUTPUT_DIRECTORY "${BUILD_DIRECTORY}"
)
find_package(OpenSSL REQUIRED)
find_package(ZLIB REQUIRED)
target_link_libraries(mayaqua PRIVATE OpenSSL::SSL OpenSSL::Crypto ZLIB::ZLIB)
if(WIN32)
set_target_properties(mayaqua
PROPERTIES
COMPILE_PDB_NAME "mayaqua"
COMPILE_PDB_OUTPUT_DIRECTORY "${BUILD_DIRECTORY}"
)
add_subdirectory(3rdparty/zlib)
target_include_directories(mayaqua PRIVATE win32_inc)
target_include_directories(mayaqua PRIVATE 3rdparty/zlib)
if(${COMPILER_ARCHITECTURE} STREQUAL "x64")
find_library(LIB_SSL
NAMES libssl ssleay32
HINTS "${TOP_DIRECTORY}/src/BuildFiles/Library/vs2017/x64_${BUILD_TYPE}"
)
find_library(LIB_CRYPTO
NAMES libcrypto libeay32
HINTS "${TOP_DIRECTORY}/src/BuildFiles/Library/vs2017/x64_${BUILD_TYPE}"
)
else()
find_library(LIB_SSL
NAMES libssl ssleay32
HINTS "${TOP_DIRECTORY}/src/BuildFiles/Library/vs2017/Win32_${BUILD_TYPE}"
)
find_library(LIB_CRYPTO
NAMES libcrypto libeay32
HINTS "${TOP_DIRECTORY}/src/BuildFiles/Library/vs2017/Win32_${BUILD_TYPE}"
)
endif()
target_link_libraries(mayaqua PRIVATE zlibstatic ${LIB_SSL} ${LIB_CRYPTO})
endif()
if(UNIX)
find_package(OpenSSL REQUIRED)
find_package(Threads REQUIRED)
find_package(ZLIB REQUIRED)
# In some cases libiconv is not included in libc
find_library(LIB_ICONV iconv)
find_library(LIB_RT rt)
target_link_libraries(mayaqua PRIVATE OpenSSL::SSL OpenSSL::Crypto Threads::Threads ZLIB::ZLIB)
target_link_libraries(mayaqua PRIVATE Threads::Threads)
if (CMAKE_SYSTEM_PROCESSOR MATCHES "^(armv7l|aarch64|s390x)$" OR NOT HAVE_SYS_AUXV OR SKIP_CPU_FEATURES)
add_definitions(-DSKIP_CPU_FEATURES)