You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by an...@apache.org on 2017/12/06 01:33:39 UTC

[1/4] mesos git commit: Windows: Documented additional step for running JVM code.

Repository: mesos
Updated Branches:
  refs/heads/master 75ebbbe9f -> d72d60924


Windows: Documented additional step for running JVM code.

The error message returned when the JVM dependencies cannot be found is
difficult to understand, especially for those unfamiliar with runtime
library loading on Windows. Added this information to the existing
documentation. Also clarified why the `JAVA_JVM_VARIABLE` environment
variable needs to be manually set on Windows.

Note that this and the OpenSSL example probably belong in `windows.md`
instead of `cmake-examples.md`.


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

Branch: refs/heads/master
Commit: d72d609242a01f59d8e59e771fa05874303e0069
Parents: 1f6c5d1
Author: Andrew Schwartzmeyer <an...@schwartzmeyer.com>
Authored: Tue Dec 5 16:33:33 2017 -0800
Committer: Andrew Schwartzmeyer <an...@schwartzmeyer.com>
Committed: Tue Dec 5 17:32:18 2017 -0800

----------------------------------------------------------------------
 docs/cmake-examples.md | 22 ++++++++++++++++++----
 1 file changed, 18 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/d72d6092/docs/cmake-examples.md
----------------------------------------------------------------------
diff --git a/docs/cmake-examples.md b/docs/cmake-examples.md
index fe2cfab..e3149bf 100644
--- a/docs/cmake-examples.md
+++ b/docs/cmake-examples.md
@@ -369,7 +369,7 @@ An installation of the Java SDK can be found form [Oracle][].
 
 As of this writing, Java 9 is not yet supported, but Java 8 has been tested.
 
-The Java build defaults to `OFF` because it is slow, to build the Java
+The Java build defaults to `OFF` because it is slow. To build the Java
 components on Windows, turn it `ON`:
 
 ```powershell
@@ -383,11 +383,25 @@ cmake --build . --target mesos-java
 Note that the `mesos-java` library does not have to be manually built; as
 `libmesos` will link it when Java is enabled.
 
-At runtime, if `JAVA_JVM_LIBRARY` is not set correctly, it can also be set as an
-environment variable, and should be of the form:
+Unfortunately, on Windows the `FindJNI` CMake module will populate `JAVA_JVM_LIBRARY` with
+the path to the static `jvm.lib`, but this variable must point to the shared
+library, `jvm.dll`, as it is loaded at runtime. Set it correctly like this:
 
 ```
-C:\Program Files\Java\jdk1.8.0_144\jre\bin\server\jvm.dll
+$env:JAVA_JVM_LIBRARY = "C:\Program Files\Java\jdk1.8.0_144\jre\bin\server\jvm.dll"
+```
+
+The library may still fail to load at runtime with the following error:
+
+> "The specified module could not be found."
+
+If this is the case, and the path to `jvm.dll` is verified to be correct, then
+the error message actually indicates that the dependencies of `jvm.dll` could
+not be found. On Windows, the DLL search path includes the environment variable
+`PATH`, so add the `bin` folder which contains `server\jvm.dll` to `PATH`:
+
+```
+$env:PATH += ";C:\Program Files\Java\jdk1.8.0_144\jre\bin"
 ```
 
 ## Building with OpenSSL


[3/4] mesos git commit: Fixed CMake binary dependencies.

Posted by an...@apache.org.
Fixed CMake binary dependencies.

This resolves MESOS-8035 so that building just the `mesos-agent`, etc.
target should correctly build its runtime dependencies (such as the
containerizer, executor, etc.).

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


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

Branch: refs/heads/master
Commit: 1f6c5d165f5656ac2a40fc30bd86e40f647e914c
Parents: 57d5862
Author: Andrew Schwartzmeyer <an...@schwartzmeyer.com>
Authored: Thu Oct 26 12:51:06 2017 -0700
Committer: Andrew Schwartzmeyer <an...@schwartzmeyer.com>
Committed: Tue Dec 5 17:32:18 2017 -0800

----------------------------------------------------------------------
 src/local/CMakeLists.txt |  1 +
 src/slave/CMakeLists.txt | 18 ++++++++++++++++++
 src/tests/CMakeLists.txt | 20 ++++----------------
 3 files changed, 23 insertions(+), 16 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/1f6c5d16/src/local/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/src/local/CMakeLists.txt b/src/local/CMakeLists.txt
index 5e5bee3..7be3ede 100644
--- a/src/local/CMakeLists.txt
+++ b/src/local/CMakeLists.txt
@@ -21,4 +21,5 @@ if (NOT WIN32)
   ###########################################################
   add_executable(mesos-local main.cpp)
   target_link_libraries(mesos-local PRIVATE mesos)
+  add_dependencies(mesos-local mesos-agent mesos-master)
 endif ()

http://git-wip-us.apache.org/repos/asf/mesos/blob/1f6c5d16/src/slave/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/src/slave/CMakeLists.txt b/src/slave/CMakeLists.txt
index 6f08f3d..638d602 100644
--- a/src/slave/CMakeLists.txt
+++ b/src/slave/CMakeLists.txt
@@ -23,3 +23,21 @@ add_subdirectory(resource_estimators)
 #######################
 add_executable(mesos-agent main.cpp)
 target_link_libraries(mesos-agent PRIVATE mesos)
+
+# Add binary dependencies
+add_dependencies(
+  mesos-agent
+  mesos-containerizer
+  mesos-default-executor
+  mesos-docker-executor
+  mesos-executor
+  mesos-tcp-connect
+  mesos-usage)
+
+if (NOT WIN32)
+  add_dependencies(
+    mesos-agent
+    mesos-cni-port-mapper
+    mesos-fetcher
+    mesos-io-switchboard)
+endif ()

http://git-wip-us.apache.org/repos/asf/mesos/blob/1f6c5d16/src/tests/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/src/tests/CMakeLists.txt b/src/tests/CMakeLists.txt
index b74fbb9..92db731 100644
--- a/src/tests/CMakeLists.txt
+++ b/src/tests/CMakeLists.txt
@@ -264,16 +264,7 @@ add_executable(test-helper EXCLUDE_FROM_ALL ${TEST_HELPER_SRC})
 target_link_libraries(test-helper PRIVATE mesos-tests-interface)
 
 # The tests require these binaries.
-add_dependencies(
-  mesos-tests
-  test-helper
-  mesos-agent
-  mesos-default-executor
-  mesos-docker-executor
-  mesos-executor
-  mesos-containerizer
-  mesos-tcp-connect
-  mesos-usage)
+add_dependencies(mesos-tests test-helper mesos-agent)
 
 if (NOT WIN32)
   # The tests require these binaries.
@@ -281,13 +272,10 @@ if (NOT WIN32)
   add_dependencies(
     mesos-tests
     mesos-execute
-    mesos-fetcher
-    mesos-log
     mesos-local
-    mesos-master
-    mesos-io-switchboard
-    mesos-cni-port-mapper
-    mesos-logrotate-logger)
+    mesos-log
+    mesos-logrotate-logger
+    mesos-master)
 
   # The tests require all the test modules. These are not directly linked but
   # instead loaded at runtime, hence the manual dependency here.


[4/4] mesos git commit: Moved Java build code to `java/CMakeLists.txt`.

Posted by an...@apache.org.
Moved Java build code to `java/CMakeLists.txt`.

The Java build code was slightly modified when moved:

The Protobuf version was changed from being hardcoded to using the
variable `${PROTOBUF_VERSION}` defined in
`3rdparty/cmake/Versions.cmake`.

The source file paths were updated to the new path, e.g.
`java/src/org/apache/mesos/Executor.java` ->
`src/org/apache/mesos/Executor.java`.

The `mesos-jar` target was given the dependency `mesos-protobufs`, which
is accurate but was missing.

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


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

Branch: refs/heads/master
Commit: a9943318364e12d3d74018d8d44dd74d166ddd5d
Parents: 75ebbbe
Author: Andrew Schwartzmeyer <an...@schwartzmeyer.com>
Authored: Thu Oct 26 12:09:02 2017 -0700
Committer: Andrew Schwartzmeyer <an...@schwartzmeyer.com>
Committed: Tue Dec 5 17:32:18 2017 -0800

----------------------------------------------------------------------
 src/CMakeLists.txt      | 129 +------------------------------------------
 src/java/CMakeLists.txt | 129 +++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 130 insertions(+), 128 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/a9943318/src/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index a76ba1e..8da64e8 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -105,134 +105,7 @@ endif ()
 # BUILD JAVA ARTIFACTS.
 #######################
 if (HAS_JAVA)
-  # Build the Mesos JAR.
-  #
-  # NOTE: We do not utilize CMake's `UseJava` module for a few reasons:
-  #   (1) `add_jar()` calls `javac`, but we use Maven.
-  #   (2) `add_jar()` does not support something like `IMPORTED`.
-  #   (3) `create_javah()` checks the existence of each JAR in the given class
-  #       path at configuration time, even though it depends on `mesos-jar` to
-  #       run Maven at build time. Coupled with (1) and (2) this makes it
-  #       impossible to use.
-  set(MESOS_JAR ${CMAKE_CURRENT_BINARY_DIR}/java/target/mesos-${MESOS_PACKAGE_VERSION}.jar)
-  set(PROTOBUF_JAR ${CMAKE_CURRENT_BINARY_DIR}/java/target/dependency/protobuf-java-3.5.0.jar)
-
-  # This file is generated into the build tree.
-  set(MESOS_JAVA_LIBRARY java/generated/org/apache/mesos/MesosNativeLibrary.java)
-  configure_file(${MESOS_JAVA_LIBRARY}.in ${MESOS_JAVA_LIBRARY})
-
-  set(MESOS_JAR_SRC
-    java/src/org/apache/mesos/ExecutorDriver.java
-    java/src/org/apache/mesos/Executor.java
-    java/src/org/apache/mesos/Log.java
-    java/src/org/apache/mesos/MesosExecutorDriver.java
-    java/src/org/apache/mesos/MesosSchedulerDriver.java
-    java/src/org/apache/mesos/SchedulerDriver.java
-    java/src/org/apache/mesos/Scheduler.java
-    java/src/org/apache/mesos/state/AbstractState.java
-    java/src/org/apache/mesos/state/InMemoryState.java
-    java/src/org/apache/mesos/state/LevelDBState.java
-    java/src/org/apache/mesos/state/LogState.java
-    java/src/org/apache/mesos/state/State.java
-    java/src/org/apache/mesos/state/Variable.java
-    java/src/org/apache/mesos/state/ZooKeeperState.java
-    java/src/org/apache/mesos/v1/scheduler/V1Mesos.java
-    java/src/org/apache/mesos/v1/scheduler/Mesos.java
-    java/src/org/apache/mesos/v1/scheduler/Scheduler.java
-    java/src/org/apache/mesos/v1/scheduler/V0Mesos.java
-    ${CMAKE_CURRENT_BINARY_DIR}/${MESOS_JAVA_LIBRARY})
-
-  configure_file(java/mesos.pom.in java/mesos.pom)
-
-  add_custom_command(
-    COMMENT "Building ${MESOS_JAR} using Maven..."
-    OUTPUT ${MESOS_JAR}
-    COMMAND mvn -B -f mesos.pom clean package
-    DEPENDS ${MESOS_JAR_SRC} ${JAVA_PROTOBUF_SRC}
-    WORKING_DIRECTORY java)
-
-  add_custom_target(mesos-jar DEPENDS ${MESOS_JAR})
-
-  # TODO(andschwa): Build the Example JAR.
-  set(EXAMPLE_JAR_SRC
-    examples/java/TestExceptionFramework.java
-    examples/java/TestExecutor.java
-    examples/java/TestFramework.java
-    examples/java/TestLog.java
-    examples/java/TestMultipleExecutorsFramework.java
-    examples/java/V1TestFramework.java)
-
-  set(JAVA_SRC
-    java/jni/convert.cpp
-    java/jni/construct.cpp
-    java/jni/org_apache_mesos_Log.cpp
-    java/jni/org_apache_mesos_MesosExecutorDriver.cpp
-    java/jni/org_apache_mesos_MesosNativeLibrary.cpp
-    java/jni/org_apache_mesos_MesosSchedulerDriver.cpp
-    java/jni/org_apache_mesos_state_AbstractState.cpp
-    java/jni/org_apache_mesos_state_LevelDBState.cpp
-    java/jni/org_apache_mesos_state_LogState.cpp
-    java/jni/org_apache_mesos_state_Variable.cpp
-    java/jni/org_apache_mesos_state_ZooKeeperState.cpp
-    java/jni/org_apache_mesos_v1_scheduler_V1Mesos.cpp
-    java/jni/org_apache_mesos_v1_scheduler_V0Mesos.cpp
-    jvm/jvm.cpp
-    jvm/org/apache/log4j.cpp
-    jvm/org/apache/zookeeper.cpp)
-
-  # These are generated and so must be included.
-  set(JAVA_H
-    java/jni/org_apache_mesos_Log.h
-    java/jni/org_apache_mesos_MesosExecutorDriver.h
-    java/jni/org_apache_mesos_MesosSchedulerDriver.h
-    java/jni/org_apache_mesos_state_AbstractState.h
-    java/jni/org_apache_mesos_state_LevelDBState.h
-    java/jni/org_apache_mesos_state_LogState.h
-    java/jni/org_apache_mesos_state_Variable.h
-    java/jni/org_apache_mesos_state_ZooKeeperState.h
-    java/jni/org_apache_mesos_v1_scheduler_V1Mesos.h
-    java/jni/org_apache_mesos_v1_scheduler_V0Mesos.h)
-
-  set(JAVA_CLASSES
-    org.apache.mesos.Log
-    org.apache.mesos.MesosExecutorDriver
-    org.apache.mesos.MesosSchedulerDriver
-    org.apache.mesos.state.AbstractState
-    org.apache.mesos.state.LevelDBState
-    org.apache.mesos.state.LogState
-    org.apache.mesos.state.Variable
-    org.apache.mesos.state.ZooKeeperState
-    org.apache.mesos.v1.scheduler.V1Mesos
-    org.apache.mesos.v1.scheduler.V0Mesos)
-
-  # This generates the header files.
-  if (WIN32)
-    set(COLON ";")
-  else ()
-    set(COLON ":")
-  endif ()
-
-  add_custom_command(
-    OUTPUT ${JAVA_H}
-    COMMAND ${Java_JAVAH_EXECUTABLE} -d java/jni -classpath "${MESOS_JAR}${COLON}${PROTOBUF_JAR}" ${JAVA_CLASSES}
-    DEPENDS mesos-jar make_bin_jni_dir)
-
-  # We include the headers here to establish the dependency
-  # on the above custom command.
-  add_library(mesos-java ${JAVA_SRC} ${JAVA_H})
-
-  target_link_libraries(
-    mesos-java
-    mesos-protobufs
-    process
-    zookeeper
-    ${JNI_LIBRARIES})
-
-  target_include_directories(
-    mesos-java PUBLIC
-    ${JNI_INCLUDE_DIRS}
-    ${CMAKE_CURRENT_BINARY_DIR}/java/jni
-    ${MESOS_PUBLIC_INCLUDE_DIR})
+  add_subdirectory(java)
 endif ()
 
 

http://git-wip-us.apache.org/repos/asf/mesos/blob/a9943318/src/java/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/src/java/CMakeLists.txt b/src/java/CMakeLists.txt
new file mode 100644
index 0000000..29422e9
--- /dev/null
+++ b/src/java/CMakeLists.txt
@@ -0,0 +1,129 @@
+# BUILD JAVA ARTIFACTS.
+#######################
+# Build the Mesos JAR.
+#
+# NOTE: We do not utilize CMake's `UseJava` module for a few reasons:
+#   (1) `add_jar()` calls `javac`, but we use Maven.
+#   (2) `add_jar()` does not support something like `IMPORTED`.
+#   (3) `create_javah()` checks the existence of each JAR in the given class
+#       path at configuration time, even though it depends on `mesos-jar` to
+#       run Maven at build time. Coupled with (1) and (2) this makes it
+#       impossible to use.
+set(MESOS_JAR ${CMAKE_CURRENT_BINARY_DIR}/target/mesos-${MESOS_PACKAGE_VERSION}.jar)
+set(PROTOBUF_JAR ${CMAKE_CURRENT_BINARY_DIR}/target/dependency/protobuf-java-${PROTOBUF_VERSION}.jar)
+
+# This file is generated into the build tree.
+set(MESOS_JAVA_LIBRARY generated/org/apache/mesos/MesosNativeLibrary.java)
+configure_file(${MESOS_JAVA_LIBRARY}.in ${MESOS_JAVA_LIBRARY})
+
+set(MESOS_JAR_SRC
+  src/org/apache/mesos/ExecutorDriver.java
+  src/org/apache/mesos/Executor.java
+  src/org/apache/mesos/Log.java
+  src/org/apache/mesos/MesosExecutorDriver.java
+  src/org/apache/mesos/MesosSchedulerDriver.java
+  src/org/apache/mesos/SchedulerDriver.java
+  src/org/apache/mesos/Scheduler.java
+  src/org/apache/mesos/state/AbstractState.java
+  src/org/apache/mesos/state/InMemoryState.java
+  src/org/apache/mesos/state/LevelDBState.java
+  src/org/apache/mesos/state/LogState.java
+  src/org/apache/mesos/state/State.java
+  src/org/apache/mesos/state/Variable.java
+  src/org/apache/mesos/state/ZooKeeperState.java
+  src/org/apache/mesos/v1/scheduler/V1Mesos.java
+  src/org/apache/mesos/v1/scheduler/Mesos.java
+  src/org/apache/mesos/v1/scheduler/Scheduler.java
+  src/org/apache/mesos/v1/scheduler/V0Mesos.java
+  ${CMAKE_CURRENT_BINARY_DIR}/${MESOS_JAVA_LIBRARY})
+
+configure_file(mesos.pom.in mesos.pom)
+
+add_custom_command(
+  COMMENT "Building ${MESOS_JAR} using Maven..."
+  OUTPUT ${MESOS_JAR}
+  COMMAND mvn -B -f mesos.pom clean package
+  DEPENDS ${MESOS_JAR_SRC} ${JAVA_PROTOBUF_SRC})
+
+add_custom_target(mesos-jar DEPENDS ${MESOS_JAR} mesos-protobufs)
+
+# TODO(andschwa): Build the Example JAR.
+set(EXAMPLE_JAR_SRC
+  ../examples/java/TestExceptionFramework.java
+  ../examples/java/TestExecutor.java
+  ../examples/java/TestFramework.java
+  ../examples/java/TestLog.java
+  ../examples/java/TestMultipleExecutorsFramework.java
+  ../examples/java/V1TestFramework.java)
+
+set(JAVA_SRC
+  jni/convert.cpp
+  jni/construct.cpp
+  jni/org_apache_mesos_Log.cpp
+  jni/org_apache_mesos_MesosExecutorDriver.cpp
+  jni/org_apache_mesos_MesosNativeLibrary.cpp
+  jni/org_apache_mesos_MesosSchedulerDriver.cpp
+  jni/org_apache_mesos_state_AbstractState.cpp
+  jni/org_apache_mesos_state_LevelDBState.cpp
+  jni/org_apache_mesos_state_LogState.cpp
+  jni/org_apache_mesos_state_Variable.cpp
+  jni/org_apache_mesos_state_ZooKeeperState.cpp
+  jni/org_apache_mesos_v1_scheduler_V1Mesos.cpp
+  jni/org_apache_mesos_v1_scheduler_V0Mesos.cpp
+  ../jvm/jvm.cpp
+  ../jvm/org/apache/log4j.cpp
+  ../jvm/org/apache/zookeeper.cpp)
+
+# These are generated and so must be included.
+set(JAVA_H
+  jni/org_apache_mesos_Log.h
+  jni/org_apache_mesos_MesosExecutorDriver.h
+  jni/org_apache_mesos_MesosSchedulerDriver.h
+  jni/org_apache_mesos_state_AbstractState.h
+  jni/org_apache_mesos_state_LevelDBState.h
+  jni/org_apache_mesos_state_LogState.h
+  jni/org_apache_mesos_state_Variable.h
+  jni/org_apache_mesos_state_ZooKeeperState.h
+  jni/org_apache_mesos_v1_scheduler_V1Mesos.h
+  jni/org_apache_mesos_v1_scheduler_V0Mesos.h)
+
+set(JAVA_CLASSES
+  org.apache.mesos.Log
+  org.apache.mesos.MesosExecutorDriver
+  org.apache.mesos.MesosSchedulerDriver
+  org.apache.mesos.state.AbstractState
+  org.apache.mesos.state.LevelDBState
+  org.apache.mesos.state.LogState
+  org.apache.mesos.state.Variable
+  org.apache.mesos.state.ZooKeeperState
+  org.apache.mesos.v1.scheduler.V1Mesos
+  org.apache.mesos.v1.scheduler.V0Mesos)
+
+# This generates the header files.
+if (WIN32)
+  set(COLON ";")
+else ()
+  set(COLON ":")
+endif ()
+
+add_custom_command(
+  OUTPUT ${JAVA_H}
+  COMMAND ${Java_JAVAH_EXECUTABLE} -d jni -classpath "${MESOS_JAR}${COLON}${PROTOBUF_JAR}" ${JAVA_CLASSES}
+  DEPENDS mesos-jar make_bin_jni_dir)
+
+# We include the headers here to establish the dependency
+# on the above custom command.
+add_library(mesos-java ${JAVA_SRC} ${JAVA_H})
+
+target_link_libraries(
+  mesos-java
+  mesos-protobufs
+  process
+  zookeeper
+  ${JNI_LIBRARIES})
+
+target_include_directories(
+  mesos-java PUBLIC
+  ${JNI_INCLUDE_DIRS}
+  ${CMAKE_CURRENT_BINARY_DIR}/jni
+  ${MESOS_PUBLIC_INCLUDE_DIR})


[2/4] mesos git commit: Set `BUILD_FLAGS` flag in CMake.

Posted by an...@apache.org.
Set `BUILD_FLAGS` flag in CMake.

This resolves MESOS-5455, and consolidates the `BUILD` variables into
one location.

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


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

Branch: refs/heads/master
Commit: 57d5862164ebc2c69aa9deba9283d723d49656bf
Parents: a994331
Author: Andrew Schwartzmeyer <an...@schwartzmeyer.com>
Authored: Thu Oct 26 12:26:11 2017 -0700
Committer: Andrew Schwartzmeyer <an...@schwartzmeyer.com>
Committed: Tue Dec 5 17:32:18 2017 -0800

----------------------------------------------------------------------
 cmake/CompilationConfigure.cmake | 18 ++++++++++++++++--
 src/CMakeLists.txt               | 15 +++------------
 src/common/build.cpp             |  5 +++++
 src/common/build_config.hpp.in   |  5 +++++
 4 files changed, 29 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/57d58621/cmake/CompilationConfigure.cmake
----------------------------------------------------------------------
diff --git a/cmake/CompilationConfigure.cmake b/cmake/CompilationConfigure.cmake
index deb5742..854e3c9 100644
--- a/cmake/CompilationConfigure.cmake
+++ b/cmake/CompilationConfigure.cmake
@@ -363,11 +363,25 @@ endif ()
 string(TIMESTAMP BUILD_DATE "%Y-%m-%d %H:%M:%S UTC" UTC)
 string(TIMESTAMP BUILD_TIME "%s" UTC)
 if (WIN32)
-  set(BUILD_USER "$ENV{USERNAME}")
+  set(BUILD_USER $ENV{USERNAME})
 else ()
-  set(BUILD_USER "$ENV{USER}")
+  set(BUILD_USER $ENV{USER})
 endif ()
 
+# NOTE: This is not quite the same as the Autotools build, as most definitions,
+# include directories, etc. are embedded as target properties within the CMake
+# graph. However, this is simply a "helper" variable anyway, so providing the
+# "global" compile definitions (at least, those of this directory), is close
+# enough to the intent.
+#
+# This code sets the variable `BUILD_FLAGS_RAW` to the content of the
+# directory's `COMPILE_DEFINITIONS` property. The backslashes are then escaped
+# and the final string is saved into the `BUILD_FLAGS` variable.
+get_directory_property(BUILD_FLAGS_RAW COMPILE_DEFINITIONS)
+string(REPLACE "\"" "\\\"" BUILD_FLAGS "${BUILD_FLAGS_RAW}")
+
+set(BUILD_JAVA_JVM_LIBRARY ${JAVA_JVM_LIBRARY})
+
 # When building from source, from a git clone, emit some extra build info.
 if (IS_DIRECTORY "${CMAKE_SOURCE_DIR}/.git")
   execute_process(

http://git-wip-us.apache.org/repos/asf/mesos/blob/57d58621/src/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 8da64e8..35a602d 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -470,8 +470,8 @@ if (WIN32)
 endif ()
 
 
-# THE MESOS LIBRARY (generates, e.g., libmesos.so on Linux).
-############################################################
+# THE MESOS LIBRARY
+###################
 add_library(mesos ${MESOS_SRC})
 
 set_target_properties(
@@ -479,16 +479,7 @@ set_target_properties(
   VERSION ${MESOS_PACKAGE_VERSION}
   SOVERSION ${MESOS_PACKAGE_SOVERSION})
 
-# NOTE: The quotes in these definitions are necessary. Without them, the
-# preprocessor will interpret the symbols as (e.g.) int literals and unquoted
-# identifiers, rather than the string values our code expects.
-target_compile_definitions(
-  mesos PUBLIC
-  USE_CMAKE_BUILD_CONFIG
-  BUILD_JAVA_JVM_LIBRARY="${JAVA_JVM_LIBRARY}"
-
-  # TODO(andschwa): (MESOS-5455) `BUILD_FLAGS` is currently a placeholder value.
-  BUILD_FLAGS="")
+target_compile_definitions(mesos PUBLIC USE_CMAKE_BUILD_CONFIG)
 
 target_include_directories(
   mesos PUBLIC

http://git-wip-us.apache.org/repos/asf/mesos/blob/57d58621/src/common/build.cpp
----------------------------------------------------------------------
diff --git a/src/common/build.cpp b/src/common/build.cpp
index 4192b89..f5271d8 100644
--- a/src/common/build.cpp
+++ b/src/common/build.cpp
@@ -48,7 +48,12 @@ const string USER = "";
 #endif
 
 const string FLAGS = BUILD_FLAGS;
+
+#ifdef BUILD_JAVA_JVM_LIBRARY
 const string JAVA_JVM_LIBRARY = BUILD_JAVA_JVM_LIBRARY;
+#else
+const string JAVA_JVM_LIBRARY = "";
+#endif
 
 #ifdef BUILD_GIT_SHA
 const Option<string> GIT_SHA = string(BUILD_GIT_SHA);

http://git-wip-us.apache.org/repos/asf/mesos/blob/57d58621/src/common/build_config.hpp.in
----------------------------------------------------------------------
diff --git a/src/common/build_config.hpp.in b/src/common/build_config.hpp.in
index ac7059a..4cce240 100644
--- a/src/common/build_config.hpp.in
+++ b/src/common/build_config.hpp.in
@@ -17,9 +17,14 @@
 #ifndef __COMMON_BUILD_CONFIG_HPP__
 #define __COMMON_BUILD_CONFIG_HPP__
 
+// NOTE: The quotes in these definitions are necessary. Without them, the
+// preprocessor will interpret the symbols as (e.g.) int literals and unquoted
+// identifiers, rather than the string values our code expects.
 #cmakedefine BUILD_DATE "@BUILD_DATE@"
 #cmakedefine BUILD_TIME "@BUILD_TIME@"
 #cmakedefine BUILD_USER "@BUILD_USER@"
+#cmakedefine BUILD_FLAGS "@BUILD_FLAGS@"
+#cmakedefine BUILD_JAVA_JVM_LIBRARY "@BUILD_JAVA_JVM_LIBRARY@"
 
 #cmakedefine BUILD_GIT_SHA "@BUILD_GIT_SHA@"
 #cmakedefine BUILD_GIT_BRANCH "@BUILD_GIT_BRANCH@"