CMake: Cleaned up `External.cmake`.

This removes a variable export which was made superfluous due to
consistency introduced by `Versions.cmake`.  In effect we would export
the version of a 3rdparty dependency to the same variable passed into
the `EXTERNAL` function.

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


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

Branch: refs/heads/master
Commit: 0ee21fb49ec5b443ed3a29c66846923e386f3c46
Parents: 93f670e
Author: Andrew Schwartzmeyer <[email protected]>
Authored: Mon Oct 2 13:57:20 2017 -0700
Committer: Joseph Wu <[email protected]>
Committed: Mon Oct 2 14:36:56 2017 -0700

----------------------------------------------------------------------
 3rdparty/cmake/External.cmake | 48 ++++++++------------------------------
 1 file changed, 10 insertions(+), 38 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/0ee21fb4/3rdparty/cmake/External.cmake
----------------------------------------------------------------------
diff --git a/3rdparty/cmake/External.cmake b/3rdparty/cmake/External.cmake
index 5bc51bd..1a55f83 100644
--- a/3rdparty/cmake/External.cmake
+++ b/3rdparty/cmake/External.cmake
@@ -19,13 +19,12 @@
 # directory structure of a dependency. In particular, if our library's name is
 # boost, we will define the following variables:
 #
-#   BOOST_VERSION    (e.g., 1.53.0)
-#   BOOST_TARGET     (a target folder name to put dep in e.g., boost-1.53.0)
+#   BOOST_TARGET     (a target folder name to put dep in e.g., `boost-1.53.0`)
 #   BOOST_CMAKE_ROOT (where to have CMake put the uncompressed source, e.g.,
-#                     build/3rdparty/boost-1.53.0)
+#                     `build/3rdparty/boost-1.53.0`)
 #   BOOST_ROOT       (where the code goes in various stages of build, e.g.,
-#                     build/.../boost-1.53.0/src, which might contain folders
-#                     build-1.53.0-build, -lib, and so on, for each build step
+#                     `build/.../boost-1.53.0/src`, which might contain folders
+#                     `build-1.53.0-build,` `-lib`, and so on, for each build 
step
 #                     that dependency has)
 function(EXTERNAL
   LIB_NAME
@@ -35,46 +34,19 @@ function(EXTERNAL
   string(TOUPPER ${LIB_NAME} LIB_NAME_UPPER)
 
   # Names of variables we will set in this function.
-  set(VERSION_VAR    ${LIB_NAME_UPPER}_VERSION)    # e.g., BOOST_VERSION
   set(TARGET_VAR     ${LIB_NAME_UPPER}_TARGET)     # e.g., BOOST_TARGET
   set(CMAKE_ROOT_VAR ${LIB_NAME_UPPER}_CMAKE_ROOT) # e.g., BOOST_CMAKE_ROOT
   set(ROOT_VAR       ${LIB_NAME_UPPER}_ROOT)       # e.g., BOOST_ROOT
 
   # Generate data that we will put in the above variables.
-  # NOTE: bundled packages are untar'd into the BIN_ROOT, which is why we're
+  # NOTE: bundled packages are extracted into the BIN_ROOT, which is why we're
   #       pointing the source root into BIN_ROOT rather than SRC_ROOT.
-  # TODO(hausdorff): SRC_DATA doesn't work for HTTP, LIBEV, GMOCK, or GTEST.
-  set(VERSION_DATA    ${LIB_VERSION})
-  set(TARGET_DATA     ${LIB_NAME}-${VERSION_DATA})
+  set(TARGET_DATA     ${LIB_NAME}-${LIB_VERSION})
   set(CMAKE_ROOT_DATA ${BIN_ROOT}/${TARGET_DATA})
   set(ROOT_DATA       ${CMAKE_ROOT_DATA}/src/${TARGET_DATA})
 
-  # Finally, EXPORT THE ABOVE VARIABLES. We take the data variables we just
-  # defined, and export them to variables in the parent scope.
-  #
-  # NOTE: The "export" step is different from the "define the data vars" step
-  #       because an expression like ${VERSION_VAR} will evaluate to
-  #       something like "BOOST_VERSION", not something like "1.53.0". That
-  #       is: to get the version in the parent scope we would do something
-  #       like ${BOOST_VERSION}, which might evaluate to something like
-  #       "1.53.0". So in this function, if you wanted to generate (e.g.) the
-  #       target variable, it is not sufficient to write
-  #       "${LIB_NAME}-${VERSION_VAR}", because this would result in
-  #       something like "boost-BOOST_VERSION" when what we really wanted was
-  #       "boost-1.53.0". Hence, these two steps are different.
-  set(${VERSION_VAR}    # e.g., 1.53.0
-    ${VERSION_DATA}
-    PARENT_SCOPE)
-
-  set(${TARGET_VAR}     # e.g., boost-1.53.0
-    ${TARGET_DATA}
-    PARENT_SCOPE)
-
-  set(${CMAKE_ROOT_VAR} # e.g., build/3rdparty/boost-1.53.0
-    ${CMAKE_ROOT_DATA}
-    PARENT_SCOPE)
-
-  set(${ROOT_VAR}       # e.g., build/.../boost-1.53.0/src
-    ${ROOT_DATA}
-    PARENT_SCOPE)
+  # Finally, export the above variables to the parent scope.
+  set(${TARGET_VAR}     ${TARGET_DATA}     PARENT_SCOPE)
+  set(${CMAKE_ROOT_VAR} ${CMAKE_ROOT_DATA} PARENT_SCOPE)
+  set(${ROOT_VAR}       ${ROOT_DATA}       PARENT_SCOPE)
 endfunction()

Reply via email to