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/01/28 02:16:04 UTC
[09/11] mesos git commit: CMake: Added configuration of test scripts
in the bin/ directory.
CMake: Added configuration of test scripts in the bin/ directory.
This adds some helper script templates to the CMake build.
These include simple bash wrappers like `bin/mesos-master.sh`
and similar wrappers which can be found in the autotools build.
Review: https://reviews.apache.org/r/55607/
Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/9b62f1fc
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/9b62f1fc
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/9b62f1fc
Branch: refs/heads/master
Commit: 9b62f1fc06506290c09d1c53fe691e67430db0f8
Parents: 8bbfa51
Author: Alex Clemmer <cl...@gmail.com>
Authored: Fri Jan 27 15:00:37 2017 -0800
Committer: Joseph Wu <jo...@apache.org>
Committed: Fri Jan 27 18:15:41 2017 -0800
----------------------------------------------------------------------
cmake/MesosConfigure.cmake | 41 +++++++++++++++++++++++++++++++++++++++++
1 file changed, 41 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/mesos/blob/9b62f1fc/cmake/MesosConfigure.cmake
----------------------------------------------------------------------
diff --git a/cmake/MesosConfigure.cmake b/cmake/MesosConfigure.cmake
index ce127e1..e44f662 100755
--- a/cmake/MesosConfigure.cmake
+++ b/cmake/MesosConfigure.cmake
@@ -178,3 +178,44 @@ set(MESOS_LIBS_TARGET mesos-${MESOS_PACKAGE_VERSION}
set(MESOS_PROTOBUF_TARGET mesos-protobufs
CACHE STRING "Library of protobuf definitions used by Mesos")
+
+# MESOS SCRIPT CONFIGURATION.
+#############################
+if (NOT WIN32)
+ # Create build bin/ directory. We will place configured scripts here.
+ file(MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/bin")
+ file(MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/bin/tmp")
+
+ # Define the variables required to configure these scripts.
+ set(abs_top_srcdir "${CMAKE_SOURCE_DIR}")
+ set(abs_top_builddir "${CMAKE_BINARY_DIR}")
+ set(VERSION "${PACKAGE_VERSION}")
+
+ # Find all scripts to configure. The scripts are in the bin/ directory, and
+ # end with the `.in` suffix. For example `mesos.sh.in`.
+ file(GLOB_RECURSE BIN_FILES "${CMAKE_SOURCE_DIR}/bin/*.in")
+ foreach (BIN_FILE ${BIN_FILES})
+ # Strip the `.in` suffix off. This will be the script's name in the build
+ # bin/ directory. For example, `mesos.sh.in` -> `mesos.sh`.
+ string(REGEX MATCH "(.*).in$" MATCH ${BIN_FILE})
+ get_filename_component(OUTPUT_BIN_FILE "${CMAKE_MATCH_1}" NAME)
+
+ # Configure. Because CMake does not support configuring and setting
+ # permissions, we do this in a two-step process: we first configure the
+ # file, placing the configured file in a temporary directory, and then we
+ # "copy" the configured file to the build `bin` directory, setting the
+ # permissions as we go.
+ #
+ # NOTE: We use the `@ONLY` argument here to avoid trying to substitute
+ # the value of `${@}`, which we frequently use in the scripts.
+ configure_file(
+ ${BIN_FILE}
+ "${CMAKE_BINARY_DIR}/bin/tmp/${OUTPUT_BIN_FILE}"
+ @ONLY)
+
+ file(COPY "${CMAKE_BINARY_DIR}/bin/tmp/${OUTPUT_BIN_FILE}"
+ DESTINATION "${CMAKE_BINARY_DIR}/bin"
+ FILE_PERMISSIONS WORLD_EXECUTE OWNER_READ OWNER_WRITE)
+ endforeach (BIN_FILE)
+ file(REMOVE_RECURSE "${CMAKE_BINARY_DIR}/bin/tmp")
+endif (NOT WIN32)