[signalrclient]Fix build error (#5868)

* [signalrclient]Fix build error: LNK2019 with openssl
This commit is contained in:
JackBoosY 2019-03-30 13:21:40 +08:00 committed by Phil Christensen
parent f2ae7bf937
commit 9e8db15b96
3 changed files with 39 additions and 4 deletions

View File

@ -0,0 +1,34 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 91c2300..2439fec 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -5,6 +5,8 @@ if(NOT WIN32)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -fPIC -L -lcpprest")
endif()
+find_package(OpenSSL REQUIRED)
+
set(CPPREST_INCLUDE_DIR "" CACHE FILEPATH "Path to casablanca include dir")
include_directories (
@@ -22,6 +24,7 @@ if(NOT DISABLE_TESTS)
add_subdirectory(test)
endif()
+
if(BUILD_SHARED_LIBS)
install(FILES include/signalrclient/_exports.h DESTINATION include/signalrclient)
else()
diff --git a/src/signalrclient/CMakeLists.txt b/src/signalrclient/CMakeLists.txt
index db141eb..c4306d8 100644
--- a/src/signalrclient/CMakeLists.txt
+++ b/src/signalrclient/CMakeLists.txt
@@ -32,7 +32,7 @@ add_definitions(-DUNICODE -D_UNICODE)
add_library (signalrclient ${SOURCES})
-target_link_libraries(signalrclient ${CPPREST_SO})
+target_link_libraries(signalrclient ${CPPREST_SO} OpenSSL::SSL OpenSSL::Crypto)
install(
TARGETS signalrclient

View File

@ -1,4 +1,4 @@
Source: signalrclient
Version: 1.0.0-beta1-4
Build-Depends: cpprestsdk
Version: 1.0.0-beta1-5
Build-Depends: cpprestsdk, openssl
Description: C++ client for SignalR.

View File

@ -7,13 +7,14 @@ vcpkg_from_github(
SHA512 b38f6f946f1499080071949cbcf574405118f9acfb469441e5b5b0df3e5f0d277a83b30e0d613dc5e54732b9071e3273dac1ee65129f994d5a60eef0e45bdf6c
HEAD_REF master
PATCHES
${CMAKE_CURRENT_LIST_DIR}/0001_cmake.patch
0001_cmake.patch
0002_fix-compile-error.patch
)
vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
OPTIONS_DEBUG
-DCPPREST_SO=${CURRENT_INSTALLED_DIR}/debug/lib/cpprest_2_10.lib
-DCPPREST_SO=${CURRENT_INSTALLED_DIR}/debug/lib/cpprest_2_10d.lib
OPTIONS_RELEASE
-DCPPREST_SO=${CURRENT_INSTALLED_DIR}/lib/cpprest_2_10.lib
OPTIONS