From 058eed369ba328dce34e9c1593a9ddbfaceea2af Mon Sep 17 00:00:00 2001 From: Riccardo Spagni Date: Tue, 21 Feb 2017 17:11:12 +0200 Subject: [PATCH] cmakify openssl --- CMakeLists.txt | 17 +++++++++++++++++ external/unbound/CMakeLists.txt | 16 ---------------- src/common/CMakeLists.txt | 4 +++- 3 files changed, 20 insertions(+), 17 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c01be24d..69715738 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -311,6 +311,23 @@ else() message(STATUS "Stack trace on exception disabled") endif() +# Handle OpenSSL, used for sha256sum on binary updates +if (APPLE) + if (NOT OpenSSL_DIR) + EXECUTE_PROCESS(COMMAND brew --prefix openssl + OUTPUT_VARIABLE OPENSSL_ROOT_DIR + OUTPUT_STRIP_TRAILING_WHITESPACE) + message(STATUS "Using OpenSSL found at ${OPENSSL_ROOT_DIR}") + endif() +endif() + +find_package(OpenSSL REQUIRED) +if(STATIC) + if(UNIX) + set(OPENSSL_LIBRARIES "${OPENSSL_LIBRARIES};${CMAKE_DL_LIBS}") + endif() +endif() + if (UNIX AND NOT APPLE) # Note that at the time of this writing the -Wstrict-prototypes flag added below will make this fail set(THREADS_PREFER_PTHREAD_FLAG ON) diff --git a/external/unbound/CMakeLists.txt b/external/unbound/CMakeLists.txt index c1e2d688..cb1c0944 100644 --- a/external/unbound/CMakeLists.txt +++ b/external/unbound/CMakeLists.txt @@ -30,22 +30,6 @@ cmake_minimum_required(VERSION 2.8.7) project(unbound C) -if (APPLE) - if (NOT OpenSSL_DIR) - EXECUTE_PROCESS(COMMAND brew --prefix openssl - OUTPUT_VARIABLE OPENSSL_ROOT_DIR - OUTPUT_STRIP_TRAILING_WHITESPACE) - message(STATUS "Using OpenSSL found at ${OPENSSL_ROOT_DIR}") - endif() -endif() - -find_package(OpenSSL REQUIRED) -if(STATIC) - if(UNIX) - set(OPENSSL_LIBRARIES "${OPENSSL_LIBRARIES};${CMAKE_DL_LIBS}") - endif() -endif() - find_package(Threads) include(configure_checks.cmake) diff --git a/src/common/CMakeLists.txt b/src/common/CMakeLists.txt index eb4d4c25..6f64cfbf 100644 --- a/src/common/CMakeLists.txt +++ b/src/common/CMakeLists.txt @@ -26,6 +26,8 @@ # STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF # THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +include_directories(SYSTEM ${OPENSSL_INCLUDE_DIR}) + set(common_sources base58.cpp command_line.cpp @@ -78,7 +80,6 @@ target_link_libraries(common PUBLIC epee crypto - -lcrypto ${UNBOUND_LIBRARY} ${LIBUNWIND_LIBRARIES} ${Boost_DATE_TIME_LIBRARY} @@ -87,6 +88,7 @@ target_link_libraries(common ${Boost_THREAD_LIBRARY} ${Boost_REGEX_LIBRARY} PRIVATE + ${OPENSSL_LIBRARIES} ${EXTRA_LIBRARIES}) #monero_install_headers(common