You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by jo...@apache.org on 2017/10/11 22:37:04 UTC

[2/6] mesos git commit: CMake: Updated 3rdparty build rules regarding OpenSSL.

CMake: Updated 3rdparty build rules regarding OpenSSL.

Specifically we now forward all possible hints to `FindOpenSSL` to the
`libevent` and `curl` libraries, as they need to use SSL in the same
configured manner. Furthermore, we explicitly always set `curl` to
enable or disable its use of OpenSSL based on our use, as otherwise it
may detect an OpenSSL installation and cause conflicts (this is the same
as we already do for `libevent`.

We also prefer the multi-threaded version of OpenSSL on Windows.

Review: https://reviews.apache.org/r/62740/


Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/d6031015
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/d6031015
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/d6031015

Branch: refs/heads/master
Commit: d6031015af7686ecc7d4d48068cbe77f8f002f08
Parents: 1cf13ee
Author: Andrew Schwartzmeyer <an...@schwartzmeyer.com>
Authored: Wed Oct 11 14:32:15 2017 -0700
Committer: Joseph Wu <jo...@apache.org>
Committed: Wed Oct 11 14:47:05 2017 -0700

----------------------------------------------------------------------
 3rdparty/CMakeLists.txt          | 37 +++++++++++++++++++++++++++--------
 cmake/CompilationConfigure.cmake |  6 ++++++
 2 files changed, 35 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/d6031015/3rdparty/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/3rdparty/CMakeLists.txt b/3rdparty/CMakeLists.txt
index 4e10631..a37a8c6 100755
--- a/3rdparty/CMakeLists.txt
+++ b/3rdparty/CMakeLists.txt
@@ -120,6 +120,25 @@ foreach (lang C CXX)
   endforeach ()
 endforeach ()
 
+# For 3rdparty dependencies that use CMake to find and build against
+# OpenSSL, we forward any user-supplied options for the `FindOpenSSL` module.
+if (ENABLE_SSL)
+  if (OPENSSL_ROOT_DIR)
+    list(APPEND CMAKE_SSL_FORWARD_ARGS
+      -DOPENSSL_ROOT_DIR=${OPENSSL_ROOT_DIR})
+  endif ()
+
+  if (OPENSSL_USE_STATIC_LIBS)
+    list(APPEND CMAKE_SSL_FORWARD_ARGS
+      -DOPENSSL_USE_STATIC_LIBS=${OPENSSL_USE_STATIC_LIBS})
+  endif ()
+
+  if (OPENSSL_MSVC_STATIC_RT)
+    list(APPEND CMAKE_SSL_FORWARD_ARGS
+      -DOPENSSL_MSVC_STATIC_RT=${OPENSSL_MSVC_STATIC_RT})
+  endif ()
+endif ()
+
 # This function works around a CMake issue with setting include directories of
 # imported libraries built with `ExternalProject_Add`.
 # https://gitlab.kitware.com/cmake/cmake/issues/15052
@@ -426,8 +445,9 @@ if (ENABLE_LIBEVENT)
   endif ()
 
   set(LIBEVENT_CMAKE_ARGS
-    # NOTE: Libevent does not respect the BUILD_SHARED_LIBS global flag.
     ${CMAKE_FORWARD_ARGS}
+    ${CMAKE_SSL_FORWARD_ARGS}
+    # NOTE: Libevent does not respect the BUILD_SHARED_LIBS global flag.
     -DEVENT__BUILD_SHARED_LIBRARIES=${BUILD_SHARED_LIBS}
     -DEVENT__DISABLE_OPENSSL=$<NOT:$<BOOL:${ENABLE_SSL}>>
     -DCMAKE_C_FLAGS=$<IF:$<PLATFORM_ID:Windows>,"",-fPIC>
@@ -436,10 +456,6 @@ if (ENABLE_LIBEVENT)
     -DEVENT__DISABLE_SAMPLES=ON
     -DEVENT__DISABLE_TESTS=ON)
 
-  if (OPENSSL_ROOT_DIR)
-    list(APPEND LIBEVENT_CMAKE_ARGS -DOPENSSL_ROOT_DIR=${OPENSSL_ROOT_DIR})
-  endif ()
-
   MAKE_INCLUDE_DIR(libevent)
   GET_BYPRODUCTS(libevent)
 
@@ -541,7 +557,7 @@ if (NOT WIN32)
 endif ()
 
 
-# curl: Command line tool and library for transferring data with URLs.
+# cURL: Command line tool and library for transferring data with URLs.
 # https://curl.haxx.se
 ######################################################################
 if (WIN32)
@@ -549,8 +565,13 @@ if (WIN32)
   add_library(curl ${LIBRARY_LINKAGE} IMPORTED GLOBAL)
   add_dependencies(curl ${CURL_TARGET})
 
-  # NOTE: curl does not respect BUILD_SHARED_LIBS.
-  set(CURL_CMAKE_ARGS ${CMAKE_FORWARD_ARGS} -DBUILD_CURL_TESTS=OFF)
+  set(CURL_CMAKE_ARGS
+    ${CMAKE_FORWARD_ARGS}
+    ${CMAKE_SSL_FORWARD_ARGS}
+    -DBUILD_CURL_TESTS=OFF
+    -DCMAKE_USE_OPENSSL=${ENABLE_SSL})
+
+  # NOTE: cURL does not respect BUILD_SHARED_LIBS.
   if (NOT BUILD_SHARED_LIBS)
     # This is both a CMake argument and a pre-processor definition.
     list(APPEND CURL_CMAKE_ARGS -DCURL_STATICLIB=ON)

http://git-wip-us.apache.org/repos/asf/mesos/blob/d6031015/cmake/CompilationConfigure.cmake
----------------------------------------------------------------------
diff --git a/cmake/CompilationConfigure.cmake b/cmake/CompilationConfigure.cmake
index a94cfa1..929e45b 100644
--- a/cmake/CompilationConfigure.cmake
+++ b/cmake/CompilationConfigure.cmake
@@ -277,6 +277,12 @@ if (WIN32)
     set(CRT " /MT")
   endif ()
 
+  if (ENABLE_SSL)
+    # NOTE: We don't care about using the debug version because OpenSSL includes
+    # an adapter. However, we prefer OpenSSL to use the multi-threaded CRT.
+    set(OPENSSL_MSVC_STATIC_RT TRUE)
+  endif ()
+
   # NOTE: We APPEND ${CRT} rather than REPLACE so it gets picked up by
   # dependencies.
   foreach (lang C CXX)