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/06/12 23:16:14 UTC

[08/27] mesos git commit: CMake: Corrected configuration argument forwarding.

CMake: Corrected configuration argument forwarding.

This commit defines the `CMAKE_FORWARD_ARGS` variable, which contains
a list of arguments defined in the parent project (Mesos and 3rdparty)
which should be passed to any subprojects added via
`ExternalProject_Add`.  This argument forwarding makes sure that the
configuration of the parent and subprojects are the same.
i.e. If the parent is build in Debug mode, all dependencies should
also be built in Debug mode.

This commit passes the new variable along to projects where no other
changes need to be made.

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


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

Branch: refs/heads/master
Commit: f6314fe4481eae4d5e63c11311aafe058a3626e1
Parents: 96edbb3
Author: Andrew Schwartzmeyer <an...@schwartzmeyer.com>
Authored: Thu Jun 8 10:45:26 2017 -0700
Committer: Joseph Wu <jo...@apache.org>
Committed: Mon Jun 12 13:07:26 2017 -0700

----------------------------------------------------------------------
 3rdparty/CMakeLists.txt | 36 ++++++++++++++++++++++++++++++++++++
 1 file changed, 36 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/f6314fe4/3rdparty/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/3rdparty/CMakeLists.txt b/3rdparty/CMakeLists.txt
index 58274b8..5f416e9 100755
--- a/3rdparty/CMakeLists.txt
+++ b/3rdparty/CMakeLists.txt
@@ -55,6 +55,40 @@ if (WIN32)
   set(GLOG_URL   ${3RDPARTY_DEPENDENCIES}/glog-${GLOG_VERSION}.tar.gz)
 endif (WIN32)
 
+# This `CMAKE_FORWARD_ARGS` variable is sent as the `CMAKE_ARGS` argument to
+# the `ExternalProject_Add` macro (along with any per-project arguments), and
+# is used when the external project is configured as a CMake project.
+# If either the `CONFIGURE_COMMAND` or `BUILD_COMMAND` arguments of
+# `ExternalProject_Add` are used, then the `CMAKE_ARGS` argument will be
+# ignored.
+#
+# NOTE: The CMAKE_GENERATOR_TOOLSET is impliticly set by `ExternalProject_Add`,
+# and cannot be included twice.
+list(APPEND CMAKE_FORWARD_ARGS
+  # TODO(andschwa): Set the CMAKE_GENERATOR explicitly as an argmuent to
+  # `ExternalProject_Add`.
+  -G${CMAKE_GENERATOR}
+
+  -DBUILD_SHARED_LIBS=${BUILD_SHARED_LIBS}
+  )
+
+# This only matters for single-configuration generators.
+# E.g. Makefile, but not Visual Studio.
+if (NOT "${CMAKE_BUILD_TYPE}" STREQUAL "")
+  list(APPEND CMAKE_FORWARD_ARGS -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE})
+endif ()
+
+foreach (lang C CXX)
+  list(APPEND CMAKE_FORWARD_ARGS
+    -DCMAKE_${lang}_FLAGS=${CMAKE_${lang}_FLAGS}
+    )
+
+  foreach (config DEBUG RELEASE RELWITHDEBINFO MINSIZEREL)
+    list(APPEND CMAKE_FORWARD_ARGS
+      -DCMAKE_${lang}_FLAGS_${config}=${CMAKE_${lang}_FLAGS_${config}}
+      )
+  endforeach ()
+endforeach ()
 
 # Define build/patch/configure commands for third-party libs.
 #############################################################
@@ -205,6 +239,7 @@ ExternalProject_Add(
   PREFIX            ${HTTP_PARSER_CMAKE_ROOT}
   UPDATE_COMMAND    ${HTTP_PARSER_UPDATE_CMD}
   PATCH_COMMAND     ${HTTP_PARSER_PATCH_CMD}
+  CMAKE_ARGS        ${CMAKE_FORWARD_ARGS}
   INSTALL_COMMAND   ${CMAKE_NOOP}
   URL               ${HTTP_PARSER_URL}
   URL_HASH          ${HTTP_PARSER_HASH}
@@ -215,6 +250,7 @@ if (NOT ENABLE_LIBEVENT)
     ${LIBEV_TARGET}
     PREFIX            ${LIBEV_CMAKE_ROOT}
     PATCH_COMMAND     ${LIBEV_PATCH_CMD}
+    CMAKE_ARGS        ${CMAKE_FORWARD_ARGS}
     CONFIGURE_COMMAND ${LIBEV_CONFIG_CMD}
     BUILD_COMMAND     ${LIBEV_BUILD_CMD}
     INSTALL_COMMAND   ${LIBEV_INSTALL_CMD}