From 5db78acab4da367a9bd42997e769ae631e086391 Mon Sep 17 00:00:00 2001 From: Andrew Nelless Date: Tue, 27 Sep 2016 15:01:58 +0100 Subject: [PATCH] #5628 Link Synergy core against OpenSSL --- src/CMakeLists.txt | 32 ++++++++++++++++++++++++++++++ src/cmd/synergyc/CMakeLists.txt | 2 +- src/cmd/synergyd/CMakeLists.txt | 2 +- src/cmd/synergyp/CMakeLists.txt | 2 +- src/cmd/synergys/CMakeLists.txt | 2 +- src/cmd/syntool/CMakeLists.txt | 2 +- src/lib/net/CMakeLists.txt | 1 + src/test/integtests/CMakeLists.txt | 2 +- src/test/unittests/CMakeLists.txt | 2 +- 9 files changed, 40 insertions(+), 7 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index d75c0adcc8..237ba4843b 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -14,6 +14,38 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +if (WIN32) + if(CMAKE_SIZEOF_VOID_P EQUAL 8) + set(OPENSSL_PLAT_DIR openssl-win64) + else() + set(OPENSSL_PLAT_DIR openssl-win32) + endif() + set(OPENSSL_INCLUDE ${CMAKE_SOURCE_DIR}/ext/${OPENSSL_PLAT_DIR}/inc32) +endif() + +if (APPLE) + set(OPENSSL_PLAT_DIR openssl-osx) + set(OPENSSL_INCLUDE ${CMAKE_SOURCE_DIR}/ext/${OPENSSL_PLAT_DIR}/include) +endif() + +if (WIN32) + set(OPENSSL_LIBS + ${CMAKE_SOURCE_DIR}/ext/${OPENSSL_PLAT_DIR}/out32dll/libeay32.lib + ${CMAKE_SOURCE_DIR}/ext/${OPENSSL_PLAT_DIR}/out32dll/ssleay32.lib + ) +endif() + +if (UNIX) + if (APPLE) + set(OPENSSL_LIBS + ${CMAKE_SOURCE_DIR}/ext/${OPENSSL_PLAT_DIR}/libssl.a + ${CMAKE_SOURCE_DIR}/ext/${OPENSSL_PLAT_DIR}/libcrypto.a + ) + else() + set(OPENSSL_LIBS ssl crypto) + endif() +endif() + add_subdirectory(lib) add_subdirectory(cmd) add_subdirectory(micro) diff --git a/src/cmd/synergyc/CMakeLists.txt b/src/cmd/synergyc/CMakeLists.txt index 11d428d449..22bbe2573d 100644 --- a/src/cmd/synergyc/CMakeLists.txt +++ b/src/cmd/synergyc/CMakeLists.txt @@ -58,7 +58,7 @@ endif() add_executable(synergyc ${sources}) target_link_libraries(synergyc - arch base client common io mt net ipc platform server synergy ${libs}) + arch base client common io mt net ipc platform server synergy ${libs} ${OPENSSL_LIBS}) if (CONF_CPACK) install(TARGETS diff --git a/src/cmd/synergyd/CMakeLists.txt b/src/cmd/synergyd/CMakeLists.txt index 1caa35b52f..005648f3d0 100644 --- a/src/cmd/synergyd/CMakeLists.txt +++ b/src/cmd/synergyd/CMakeLists.txt @@ -35,7 +35,7 @@ else() endif() target_link_libraries(synergyd - arch base common io ipc mt net platform synergy ${libs}) + arch base common io ipc mt net platform synergy ${libs} ${OPENSSL_LIBS}) if (CONF_CPACK) install(TARGETS diff --git a/src/cmd/synergyp/CMakeLists.txt b/src/cmd/synergyp/CMakeLists.txt index 171ef9990b..c99892528a 100644 --- a/src/cmd/synergyp/CMakeLists.txt +++ b/src/cmd/synergyp/CMakeLists.txt @@ -63,7 +63,7 @@ else() endif() target_link_libraries(synergyp - arch base client common io mt net ipc platform server synergy client ${libs}) + arch base client common io mt net ipc platform server synergy client ${libs} ${OPENSSL_LIBS}) if (CONF_CPACK) install(TARGETS diff --git a/src/cmd/synergys/CMakeLists.txt b/src/cmd/synergys/CMakeLists.txt index c749e09a81..2474bcc670 100644 --- a/src/cmd/synergys/CMakeLists.txt +++ b/src/cmd/synergys/CMakeLists.txt @@ -58,7 +58,7 @@ endif() add_executable(synergys ${sources}) target_link_libraries(synergys - arch base client common io mt net ipc platform server synergy ${libs}) + arch base client common io mt net ipc platform server synergy ${libs} ${OPENSSL_LIBS}) if (CONF_CPACK) install(TARGETS diff --git a/src/cmd/syntool/CMakeLists.txt b/src/cmd/syntool/CMakeLists.txt index 7f10c010b4..ffbb61aa0e 100644 --- a/src/cmd/syntool/CMakeLists.txt +++ b/src/cmd/syntool/CMakeLists.txt @@ -29,7 +29,7 @@ endif() add_executable(syntool ${sources}) target_link_libraries(syntool - synergy arch base client common io ipc mt net platform server ${libs}) + synergy arch base client common io ipc mt net platform server ${libs} ${OPENSSL_LIBS}) if (CONF_CPACK) install(TARGETS diff --git a/src/lib/net/CMakeLists.txt b/src/lib/net/CMakeLists.txt index ee50fe3645..6e3527e439 100644 --- a/src/lib/net/CMakeLists.txt +++ b/src/lib/net/CMakeLists.txt @@ -23,6 +23,7 @@ endif() include_directories( ../ + ${OPENSSL_INCLUDE} ) if (UNIX) diff --git a/src/test/integtests/CMakeLists.txt b/src/test/integtests/CMakeLists.txt index bde35c2faf..2f1ca7f39c 100644 --- a/src/test/integtests/CMakeLists.txt +++ b/src/test/integtests/CMakeLists.txt @@ -68,4 +68,4 @@ endif() add_executable(integtests ${sources}) target_link_libraries(integtests - arch base client common io ipc mt net platform server synergy gtest gmock ${libs}) + arch base client common io ipc mt net platform server synergy gtest gmock ${libs} ${OPENSSL_LIBS}) diff --git a/src/test/unittests/CMakeLists.txt b/src/test/unittests/CMakeLists.txt index 4cacdf9361..4cdab9bf1f 100644 --- a/src/test/unittests/CMakeLists.txt +++ b/src/test/unittests/CMakeLists.txt @@ -68,4 +68,4 @@ endif() add_executable(unittests ${sources}) target_link_libraries(unittests - arch base client server common io net platform server synergy mt ipc gtest gmock ${libs}) + arch base client server common io net platform server synergy mt ipc gtest gmock ${libs} ${OPENSSL_LIBS})