From d3f7fe78ef6d5dafec48a329cbc6bf33c319ca86 Mon Sep 17 00:00:00 2001 From: Andy Alt Date: Sun, 14 Oct 2018 00:18:48 -0500 Subject: [PATCH] have cmake find OpenSSL (#284) * set openssl root dir apparently a common problem https://github.com/alexcrichton/ssh2-rs/issues/28 https://stackoverflow.com/questions/29792009/cmake-osx-mac-openssl-brew related to #263 --- source/glest_game/CMakeLists.txt | 3 ++- source/shared_lib/CMakeLists.txt | 22 +++++++++------------- 2 files changed, 11 insertions(+), 14 deletions(-) diff --git a/source/glest_game/CMakeLists.txt b/source/glest_game/CMakeLists.txt index b1db40435..9ef7d50b9 100644 --- a/source/glest_game/CMakeLists.txt +++ b/source/glest_game/CMakeLists.txt @@ -86,7 +86,8 @@ IF(BUILD_ZETAGLEST) ENDIF() IF(WANT_USE_OpenSSL) - FIND_PACKAGE(OpenSSL) + set(OPENSSL_ROOT_DIR /usr/local/opt/openssl) + include(FindOpenSSL) IF(OPENSSL_FOUND) INCLUDE_DIRECTORIES(${OPENSSL_INCLUDE_DIR}) ELSE() diff --git a/source/shared_lib/CMakeLists.txt b/source/shared_lib/CMakeLists.txt index 1a957206b..60154f178 100644 --- a/source/shared_lib/CMakeLists.txt +++ b/source/shared_lib/CMakeLists.txt @@ -81,25 +81,21 @@ IF(BUILD_MODEL_VIEWER OR BUILD_MAP_EDITOR OR BUILD_ZETAGLEST) ENDIF() IF(WANT_USE_OpenSSL) - FIND_PACKAGE(OpenSSL) + set(OPENSSL_ROOT_DIR /usr/local/opt/openssl) + include(FindOpenSSL) IF(OPENSSL_FOUND) - INCLUDE_DIRECTORIES(${OPENSSL_INCLUDE_DIR}) + INCLUDE_DIRECTORIES(${OPENSSL_INCLUDE_DIR}) + SET(EXTERNAL_LIBS ${EXTERNAL_LIBS} ${OPENSSL_LIBRARIES}) ELSE() - MESSAGE(STATUS "**NOTE: OpenSSL is usually not required.") + MESSAGE(STATUS "**NOTE: OpenSSL is usually not required.") ENDIF() ENDIF() include(FindCURL) - INCLUDE_DIRECTORIES(${CURL_INCLUDE_DIRS}) - IF(UNIX) - IF(NOT OPENSSL_FOUND) - # default - SET(EXTERNAL_LIBS ${EXTERNAL_LIBS} ${CURL_LIBRARIES}) - ELSE() - # mageia - SET(EXTERNAL_LIBS ${EXTERNAL_LIBS} ${CURL_LIBRARIES} ${OPENSSL_LIBRARIES}) - ENDIF() - ENDIF() + if(CURL_FOUND) + INCLUDE_DIRECTORIES(${CURL_INCLUDE_DIRS}) + SET(EXTERNAL_LIBS ${EXTERNAL_LIBS} ${CURL_LIBRARIES}) + endif() FIND_PACKAGE(${SDL_VERSION_NAME} REQUIRED) INCLUDE_DIRECTORIES(${${SDL_VERSION_NAME}_INCLUDE_DIR})