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/09/03 12:51:59 UTC

[37/42] mesos git commit: CMake: Refactored build system.

CMake: Refactored build system.

This commit deletes extraneous CMake code. With a proper CMake
dependency graph, CMake automatically calculates the correct compiler
and linker options based on the traversal of the graph, and the
properties of each target. With the correct importing of the 3rdparty
dependencies, this allows us to remove all uses of deprecated CMake
commands such as `include_directories`, `link_directories`, and
`link_libraries`. These commands rely on setting directory-wide
side-effects, unlike their explicit `target_include_directories`
counterparts, which instead add the information to the dependency graph.
By utilizing CMake's dependency graph, most uses of `add_dependencies`
were removed, as an implicit dependency is created when
`target_link_libraries` is used. Note that there are explicit cases of
manually dependencies, such as module libraries which are not linked and
therefore are not automatically added to the graph.

Furthermore, superfluous variables were removed. Due to how the original
system was written (based on copying a working template), many variables
were introduced that contained single items, such that the declaration
and interpolation of the variable became far more verbose than simply
using the contents directly. Variables holding target names were also
removed, as they were redundant. See the changes to
`src/master/CMakeLists.txt` for an example of an executable's build
going from twelve logical lines of code to two.

"Configuration" files such as `AgentConfigure.cmake`, were deleted in
their entirety, because the information they provided was redundant when
using the CMake dependency graph. The only CMake configuration files
remaining are for actual project configuration.

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


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

Branch: refs/heads/master
Commit: d10fd9b8aa1f0bcdd596fb8e6d37e0629d9e8174
Parents: 4a430e3
Author: Andrew Schwartzmeyer <an...@schwartzmeyer.com>
Authored: Thu Aug 17 15:39:16 2017 -0700
Committer: Joseph Wu <jo...@apache.org>
Committed: Sun Sep 3 05:51:09 2017 -0700

----------------------------------------------------------------------
 CMakeLists.txt                               |   4 -
 cmake/CompilationConfigure.cmake             |   1 +
 cmake/MesosConfigure.cmake                   |  81 -------
 src/CMakeLists.txt                           | 266 +++++++++-------------
 src/checks/CMakeLists.txt                    |  29 +--
 src/cli/CMakeLists.txt                       |  29 +--
 src/docker/CMakeLists.txt                    |  31 +--
 src/examples/CMakeLists.txt                  | 199 +++++-----------
 src/examples/cmake/ExamplesConfigure.cmake   |  51 -----
 src/launcher/CMakeLists.txt                  |  49 +---
 src/local/CMakeLists.txt                     |  29 +--
 src/log/CMakeLists.txt                       |  29 +--
 src/master/CMakeLists.txt                    |  36 +--
 src/master/cmake/MasterConfigure.cmake       |  69 ------
 src/slave/CMakeLists.txt                     |  29 +--
 src/slave/cmake/AgentConfigure.cmake         |  85 -------
 src/slave/container_loggers/CMakeLists.txt   |  35 +--
 src/slave/containerizer/mesos/CMakeLists.txt |  58 +----
 src/slave/qos_controllers/CMakeLists.txt     |  24 +-
 src/slave/resource_estimators/CMakeLists.txt |  25 +-
 src/tests/CMakeLists.txt                     | 189 +++++++--------
 src/tests/cmake/MesosTestsConfigure.cmake    |  96 --------
 src/usage/CMakeLists.txt                     |  19 +-
 23 files changed, 333 insertions(+), 1130 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/d10fd9b8/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 797fe2c..b506c78 100755
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -39,10 +39,6 @@ set(MESOS_PACKAGE_SOVERSION 0)
 list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake)
 list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/3rdparty/cmake)
 list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/src/cmake)
-list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/src/examples/cmake)
-list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/src/master/cmake)
-list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/src/slave/cmake)
-list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/src/tests/cmake)
 
 # Macros.
 include(Versions)

http://git-wip-us.apache.org/repos/asf/mesos/blob/d10fd9b8/cmake/CompilationConfigure.cmake
----------------------------------------------------------------------
diff --git a/cmake/CompilationConfigure.cmake b/cmake/CompilationConfigure.cmake
index 8a94cd8..9aca1ca 100644
--- a/cmake/CompilationConfigure.cmake
+++ b/cmake/CompilationConfigure.cmake
@@ -26,6 +26,7 @@ else ()
 endif ()
 
 option(BUILD_SHARED_LIBS "Build shared libraries." ${DEFAULT_BUILD_SHARED_LIBS})
+set(CMAKE_POSITION_INDEPENDENT_CODE TRUE)
 
 option(ENABLE_JAVA "Build Java components. Warning: this is SLOW." OFF)
 if (ENABLE_JAVA)

http://git-wip-us.apache.org/repos/asf/mesos/blob/d10fd9b8/cmake/MesosConfigure.cmake
----------------------------------------------------------------------
diff --git a/cmake/MesosConfigure.cmake b/cmake/MesosConfigure.cmake
old mode 100755
new mode 100644
index 93a85e5..c5435f8
--- a/cmake/MesosConfigure.cmake
+++ b/cmake/MesosConfigure.cmake
@@ -50,13 +50,6 @@ enable_testing()
 #####################
 include(CompilationConfigure)
 
-if (BUILD_SHARED_LIBS)
-  set(MESOS_DEFAULT_LIBRARY_LINKAGE "SHARED")
-  set(CMAKE_POSITION_INDEPENDENT_CODE TRUE)
-else ()
-  set(MESOS_DEFAULT_LIBRARY_LINKAGE "STATIC")
-endif ()
-
 # DEFINE DIRECTORY STRUCTURE MESOS PROJECT.
 ###########################################
 set(MESOS_SRC_DIR     ${CMAKE_SOURCE_DIR}/src)
@@ -94,80 +87,6 @@ add_custom_target(
   DEPENDS make_bin_src_dir
   COMMAND ${CMAKE_COMMAND} -E make_directory ${MESOS_BIN_SRC_DIR}/java/jni)
 
-# CONFIGURE AGENT.
-##################
-include(AgentConfigure)
-
-# CONFIGURE MASTER.
-##################
-include(MasterConfigure)
-
-# CONFIGURE EXAMPLE MODULES AND FRAMEWORKS.
-###########################################
-include(ExamplesConfigure)
-
-# DEFINE MESOS BUILD TARGETS.
-#############################
-set(
-  AGENT_TARGET mesos-agent
-  CACHE STRING "Target we use to refer to agent executable")
-
-set(
-  DEFAULT_EXECUTOR_TARGET mesos-default-executor
-  CACHE STRING "Target for the default executor")
-
-set(
-  MESOS_CONTAINERIZER mesos-containerizer
-  CACHE STRING "Target for containerizer")
-
-set(
-  MESOS_DOCKER_EXECUTOR mesos-docker-executor
-  CACHE STRING "Target for docker executor")
-
-set(
-  MESOS_EXECUTOR mesos-executor
-  CACHE STRING "Target for command executor")
-
-set(
-  MESOS_FETCHER mesos-fetcher
-  CACHE STRING "Target for fetcher")
-
-if (NOT WIN32)
-  set(
-    MESOS_IO_SWITCHBOARD mesos-io-switchboard
-    CACHE STRING "Target for the IO switchboard")
-
-  set(
-    MESOS_CNI_PORT_MAPPER mesos-cni-port-mapper
-    CACHE STRING "Target for the CNI port-mapper plugin")
-endif ()
-
-set(
-  MESOS_MASTER mesos-master
-  CACHE STRING "Target for master")
-
-set(
-  MESOS_TCP_CONNECT mesos-tcp-connect
-  CACHE STRING "Target for tcp-connect")
-
-set(
-  MESOS_USAGE mesos-usage
-  CACHE STRING "Target for usage")
-
-# MESOS LIBRARY CONFIGURATION.
-##############################
-set(
-  MESOS_TARGET mesos-and-binaries
-  CACHE STRING "Target that includes libmesos and all required binaries")
-
-add_custom_target(${MESOS_TARGET} ALL)
-
-set(MESOS_LIBS_TARGET mesos-${MESOS_PACKAGE_VERSION}
-    CACHE STRING "Library of master and agent code")
-
-set(MESOS_PROTOBUF_TARGET mesos-protobufs
-    CACHE STRING "Library of protobuf definitions used by Mesos")
-
 # MESOS SCRIPT CONFIGURATION.
 #############################
 # Define variables required to configure these scripts,

http://git-wip-us.apache.org/repos/asf/mesos/blob/d10fd9b8/src/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 5edfb6f..18fb4c1 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -74,23 +74,29 @@ PROTOC_GENERATE(INTERNAL TARGET master/registry)
 
 # BUILD PROTOBUFS.
 ##################
+# This must always be built as a shared library because of the following issue:
+# https://github.com/google/protobuf/issues/1941
+#
+# Unfortunately, this is not supported on Windows. But because modules are not
+# yet supported either, for now we can build it statically.
+if (WIN32)
+  set(MESOS_PROTOBUFS_LINKAGE STATIC)
+else ()
+  set(MESOS_PROTOBUFS_LINKAGE SHARED)
+endif ()
+
 add_library(
-  ${MESOS_PROTOBUF_TARGET}
-  ${MESOS_DEFAULT_LIBRARY_LINKAGE}
+  mesos-protobufs ${MESOS_PROTOBUFS_LINKAGE}
   ${PUBLIC_PROTOBUF_SRC}
-  ${INTERNAL_PROTOBUF_SRC}
-  )
+  ${INTERNAL_PROTOBUF_SRC})
 
-target_link_libraries(${MESOS_PROTOBUF_TARGET} PUBLIC protobuf)
+target_link_libraries(mesos-protobufs PUBLIC protobuf)
 target_include_directories(
-  ${MESOS_PROTOBUF_TARGET} PUBLIC
-  ${MESOS_PROTOBUF_HEADER_INCLUDE_DIRS})
+  mesos-protobufs PUBLIC ${MESOS_PROTOBUF_HEADER_INCLUDE_DIRS})
 
 if (WIN32)
   # Disable all compiler warnings on Protocol Buffers source.
-  set_target_properties(
-    ${MESOS_PROTOBUF_TARGET}
-    PROPERTIES COMPILE_FLAGS "/w")
+  target_compile_options(mesos-protobufs PRIVATE "/w")
 endif ()
 
 
@@ -211,22 +217,20 @@ if (HAS_JAVA)
 
   # We include the headers here to establish the dependency
   # on the above custom command.
-  add_library(
-    mesos-java ${MESOS_DEFAULT_LIBRARY_LINKAGE}
-    ${JAVA_SRC}
-    ${JAVA_H})
+  add_library(mesos-java ${JAVA_SRC} ${JAVA_H})
 
   target_link_libraries(
     mesos-java
-    stout
+    mesos-protobufs
+    process
     zookeeper
-    ${MESOS_PROTOBUF_TARGET}
     ${JNI_LIBRARIES})
 
   target_include_directories(
     mesos-java PUBLIC
     ${JNI_INCLUDE_DIRS}
-    ${CMAKE_CURRENT_BINARY_DIR}/java/jni)
+    ${CMAKE_CURRENT_BINARY_DIR}/java/jni
+    ${MESOS_PUBLIC_INCLUDE_DIR})
 endif ()
 
 
@@ -234,8 +238,8 @@ endif ()
 ########################
 configure_file(
   ${MESOS_PUBLIC_INCLUDE_DIR}/mesos/version.hpp.in
-  ${MESOS_BIN_INCLUDE_DIR}/mesos/version.hpp
-  )
+  ${MESOS_BIN_INCLUDE_DIR}/mesos/version.hpp)
+
 
 # SOURCE FILES FOR THE MESOS LIBRARY.
 #####################################
@@ -284,8 +288,7 @@ set(AGENT_SRC
   slave/containerizer/mesos/provisioner/docker/puller.cpp
   slave/containerizer/mesos/provisioner/docker/registry_puller.cpp
   slave/containerizer/mesos/provisioner/docker/store.cpp
-  slave/resource_estimators/noop.cpp
-  )
+  slave/resource_estimators/noop.cpp)
 
 if (NOT WIN32)
   set(AGENT_SRC
@@ -298,40 +301,34 @@ if (NOT WIN32)
     slave/containerizer/mesos/isolators/network/cni/spec.cpp
     slave/containerizer/mesos/isolators/posix/disk.cpp
     slave/containerizer/mesos/isolators/posix/rlimits.cpp
-    slave/containerizer/mesos/isolators/volume/sandbox_path.cpp
-    )
+    slave/containerizer/mesos/isolators/volume/sandbox_path.cpp)
 endif ()
 
 set(APPC_SRC
-  appc/spec.cpp
-  )
+  appc/spec.cpp)
 
 set(AUTHENTICATION_SRC
   authentication/http/basic_authenticator_factory.cpp
-  authentication/http/combined_authenticator.cpp
-  )
+  authentication/http/combined_authenticator.cpp)
 
 if (NOT WIN32)
   set(AUTHENTICATION_SRC
     ${AUTHENTICATION_SRC}
     authentication/cram_md5/authenticatee.cpp
     authentication/cram_md5/authenticator.cpp
-    authentication/cram_md5/auxprop.cpp
-    )
+    authentication/cram_md5/auxprop.cpp)
 endif ()
 
 if (ENABLE_SSL)
   set(AUTHENTICATION_SRC
     ${AUTHENTICATION_SRC}
-    authentication/executor/jwt_secret_generator.cpp
-    )
+    authentication/executor/jwt_secret_generator.cpp)
 endif ()
 
 set(AUTHORIZER_SRC
   authorizer/acls.cpp
   authorizer/authorizer.cpp
-  authorizer/local/authorizer.cpp
-  )
+  authorizer/local/authorizer.cpp)
 
 set(COMMON_SRC
   common/attributes.cpp
@@ -344,42 +341,33 @@ set(COMMON_SRC
   common/roles.cpp
   common/type_utils.cpp
   common/validation.cpp
-  common/values.cpp
-  )
+  common/values.cpp)
 
 set(DOCKER_SRC
   docker/docker.cpp
-  docker/spec.cpp
-  )
+  docker/spec.cpp)
 
 set(EXECUTOR_SRC
   exec/exec.cpp
   executor/executor.cpp
-  executor/v0_v1executor.cpp
-  )
+  executor/v0_v1executor.cpp)
 
 set(FILES_SRC
-  files/files.cpp
-  )
+  files/files.cpp)
 
 set(HDFS_SRC
-  ${HDFS_SRC}
-  hdfs/hdfs.cpp
-  )
+  hdfs/hdfs.cpp)
 
 set(HEALTH_CHECK_SRC
   checks/checker.cpp
   checks/checker_process.cpp
-  checks/health_checker.cpp
-  )
+  checks/health_checker.cpp)
 
 set(INTERNAL_SRC
   internal/devolve.cpp
-  internal/evolve.cpp
-  )
+  internal/evolve.cpp)
 
 set(LINUX_SRC
-  ${LINUX_SRC}
   linux/capabilities.cpp
   linux/cgroups.cpp
   linux/fs.cpp
@@ -419,15 +407,12 @@ set(LINUX_SRC
   slave/containerizer/mesos/isolators/volume/secret.cpp
   slave/containerizer/mesos/provisioner/backends/aufs.cpp
   slave/containerizer/mesos/provisioner/backends/bind.cpp
-  slave/containerizer/mesos/provisioner/backends/overlay.cpp
-  )
+  slave/containerizer/mesos/provisioner/backends/overlay.cpp)
 
 set(LOCAL_SRC
-  local/local.cpp
-  )
+  local/local.cpp)
 
 set(LOG_SRC
-  ${LOG_SRC}
   log/catchup.cpp
   log/consensus.cpp
   log/coordinator.cpp
@@ -440,16 +425,13 @@ set(LOG_SRC
   log/tool/benchmark.cpp
   log/tool/initialize.cpp
   log/tool/read.cpp
-  log/tool/replica.cpp
-  )
+  log/tool/replica.cpp)
 
 set(LOGGING_SRC
   logging/flags.cpp
-  logging/logging.cpp
-  )
+  logging/logging.cpp)
 
 set(MASTER_SRC
-  ${MASTER_SRC}
   master/flags.cpp
   master/http.cpp
   master/maintenance.cpp
@@ -471,26 +453,20 @@ set(MASTER_SRC
   master/contender/zookeeper.cpp
   master/detector/detector.cpp
   master/detector/standalone.cpp
-  master/detector/zookeeper.cpp
-  )
+  master/detector/zookeeper.cpp)
 
 set(MESSAGES_SRC
-  ${MESSAGES_SRC}
-  messages/messages.cpp
-  )
+  messages/messages.cpp)
 
 set(MODULE_SRC
   hook/manager.cpp
-  module/manager.cpp
-  )
+  module/manager.cpp)
 
 set(OCI_SRC
-  oci/spec.cpp
-  )
+  oci/spec.cpp)
 
 set(POSIX_SRC
-  posix/rlimits.cpp
-  )
+  posix/rlimits.cpp)
 
 set(RESOURCE_PROVIDER_SRC
   resource_provider/daemon.cpp
@@ -499,22 +475,17 @@ set(RESOURCE_PROVIDER_SRC
   resource_provider/local.cpp
   resource_provider/manager.cpp
   resource_provider/validation.cpp
-  resource_provider/storage/provider.cpp
-  )
+  resource_provider/storage/provider.cpp)
 
 set(SCHEDULER_SRC
   sched/sched.cpp
-  scheduler/scheduler.cpp
-  )
+  scheduler/scheduler.cpp)
 
 set(SECRET_SRC
-  secret/resolver.cpp
-  )
+  secret/resolver.cpp)
 
 set(STATE_SRC
-  ${STATE_SRC}
-  state/in_memory.cpp
-  )
+  state/in_memory.cpp)
 
 if (NOT WIN32)
   set(STATE_SRC
@@ -528,53 +499,43 @@ set(URI_SRC
   uri/fetcher.cpp
   uri/utils.cpp
   uri/fetchers/copy.cpp
-  uri/fetchers/curl.cpp
-  )
+  uri/fetchers/curl.cpp)
 
 if (NOT WIN32)
   set(URI_SRC
     ${URI_SRC}
     uri/fetchers/docker.cpp
-    uri/fetchers/hadoop.cpp
-    )
+    uri/fetchers/hadoop.cpp)
 endif ()
 
 set(USAGE_SRC
-  usage/usage.cpp
-  )
+  usage/usage.cpp)
 
 set(V1_SRC
   v1/attributes.cpp
   v1/mesos.cpp
   v1/resources.cpp
-  v1/values.cpp
-  )
+  v1/values.cpp)
 
 set(VERSION_SRC
-  version/version.cpp
-  )
+  version/version.cpp)
 
 set(WATCHER_SRC
-  watcher/whitelist_watcher.cpp
-  )
+  watcher/whitelist_watcher.cpp)
 
 set(WIN32_SRC
-  ${WIN32_SRC}
   slave/containerizer/mesos/isolators/environment_secret.cpp
   slave/containerizer/mesos/isolators/filesystem/posix.cpp
-  slave/containerizer/mesos/isolators/filesystem/windows.cpp
-  )
+  slave/containerizer/mesos/isolators/filesystem/windows.cpp)
 
 set(ZOOKEEPER_SRC
   zookeeper/authentication.cpp
   zookeeper/contender.cpp
   zookeeper/detector.cpp
   zookeeper/zookeeper.cpp
-  zookeeper/group.cpp
-  )
+  zookeeper/group.cpp)
 
 set(MESOS_SRC
-  ${MESOS_SRC}
   ${AGENT_SRC}
   ${APPC_SRC}
   ${AUTHENTICATION_SRC}
@@ -608,8 +569,7 @@ if (NOT WIN32)
     ${MESOS_SRC}
     ${HDFS_SRC}
     ${LOG_SRC}
-    ${POSIX_SRC}
-    )
+    ${POSIX_SRC})
 endif ()
 
 # Include source for linux build.
@@ -622,12 +582,6 @@ if (WIN32)
   set(MESOS_SRC ${MESOS_SRC} ${WIN32_SRC})
 endif ()
 
-# INCLUDE DIRECTIVES FOR MESOS LIBRARY (generates, e.g., -I/path/to/thing
-# on Linux).
-#########################################################################
-include_directories(SYSTEM ${AGENT_3RDPARTY_INCLUDE_DIRS})
-include_directories(${AGENT_INCLUDE_DIRS})
-
 # Generate all binaries in the same folder.
 set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/src)
 if (WIN32)
@@ -642,69 +596,63 @@ if (WIN32)
   SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE ${CMAKE_BINARY_DIR}/src/.libs)
 endif ()
 
-# LINKING LIBRARIES BY DIRECTORY (might generate, e.g., -L/path/to/thing on
-# Linux).
-###########################################################################
-link_directories(${AGENT_LIB_DIRS})
 
-# THE MESOS LIBRARY (generates, e.g., libmesos.so, etc., on Linux).
-###################################################################
-add_library(${MESOS_LIBS_TARGET} ${MESOS_DEFAULT_LIBRARY_LINKAGE} ${MESOS_SRC})
+# THE MESOS LIBRARY (generates, e.g., libmesos.so on Linux).
+############################################################
+add_library(mesos ${MESOS_SRC})
+
 set_target_properties(
-  ${MESOS_LIBS_TARGET} PROPERTIES
+  mesos PROPERTIES
   VERSION ${MESOS_PACKAGE_VERSION}
-  SOVERSION ${MESOS_PACKAGE_SOVERSION}
-  )
+  SOVERSION ${MESOS_PACKAGE_SOVERSION})
 
-if (ENABLE_PRECOMPILED_HEADERS)
-  # These exluded headers either cause namespace resolution issues or
-  # are problematic for incremental builds.
-  set_property(DIRECTORY
-    PROPERTY COTIRE_PREFIX_HEADER_IGNORE_PATH
-      "${CMAKE_SOURCE_DIR}/include/mesos/authentication/http/basic_authenticator_factory.hpp"
-      "${CMAKE_SOURCE_DIR}/include/mesos/authentication/http/combined_authenticator.hpp"
-      "${CMAKE_SOURCE_DIR}/src/sched/constants.hpp"
-      "${CMAKE_SOURCE_DIR}/src/sched/flags.hpp"
-      "${CMAKE_BINARY_DIR}/src/common/build_config.hpp")
-
-  # For now, we include agent headers, because the Windows build currently
-  # does not build all of the Mesos master (only enough for testing the agent).
-  set_property(DIRECTORY
-    PROPERTY COTIRE_PREFIX_HEADER_INCLUDE_PATH
-      "${AGENT_INCLUDE_DIRS};${AGENT_3RDPARTY_INCLUDE_DIRS}")
-
-  cotire(${MESOS_LIBS_TARGET})
+target_include_directories(
+  mesos PUBLIC
+  ${MESOS_PUBLIC_INCLUDE_DIR}
+
+  # Contains (e.g.) compiled *.pb.h files.
+  ${MESOS_BIN_INCLUDE_DIR}
+  ${MESOS_BIN_INCLUDE_DIR}/mesos
+  ${MESOS_BIN_SRC_DIR}
+  ${MESOS_SRC_DIR})
+
+target_link_libraries(
+  mesos PUBLIC
+  process
+  zookeeper
+  mesos-protobufs
+  $<$<PLATFORM_ID:Linux>:nvml>
+  $<$<BOOL:${HAS_JAVA}>:mesos-java>)
+
+if (NOT WIN32)
+  target_link_libraries(mesos PUBLIC leveldb sasl2)
 endif ()
 
-# ADD LIBRARY DEPENDENCIES (tells CMake what to compile/build first).
-####################################################################
-add_dependencies(${MESOS_TARGET} ${MESOS_LIBS_TARGET})
-add_dependencies(
-  ${MESOS_LIBS_TARGET}
-  ${AGENT_DEPENDENCIES}
-  )
+if (ENABLE_PRECOMPILED_HEADERS)
+  set_target_properties(
+    mesos PROPERTIES
+    COTIRE_ADD_UNITY_BUILD FALSE
+    COTIRE_PREFIX_HEADER_INCLUDE_PATH "${CMAKE_SOURCE_DIR}/3rdparty;${CMAKE_BINARY_DIR}/3rdparty")
+
+  cotire(mesos)
+endif ()
 
-# ADD LINKER FLAGS (generates, e.g., -lglog on Linux).
-######################################################
-target_link_libraries(${MESOS_LIBS_TARGET} PUBLIC
-  ${MESOS_PROTOBUF_TARGET}
-  ${AGENT_LIBS}
-  $<$<BOOL:${HAS_JAVA}>:mesos-java>)
 
 # BUILD THE MESOS EXECUTABLES.
 ##############################
-add_subdirectory(checks/)
-add_subdirectory(cli/)
-add_subdirectory(docker/)
-add_subdirectory(examples/)
-add_subdirectory(launcher/)
-add_subdirectory(local/)
-add_subdirectory(log/)
-add_subdirectory(master/)
-add_subdirectory(slave/)
-add_subdirectory(slave/containerizer/mesos/)
-add_subdirectory(usage/)
+add_subdirectory(checks)
+add_subdirectory(cli)
+add_subdirectory(docker)
+add_subdirectory(examples)
+add_subdirectory(launcher)
+add_subdirectory(local)
+add_subdirectory(log)
+add_subdirectory(master)
+add_subdirectory(slave)
+add_subdirectory(slave/containerizer/mesos)
+add_subdirectory(usage)
+
 
 # BUILD THE MESOS TESTS.
-#########################################################
-add_subdirectory(tests/)
+########################
+add_subdirectory(tests)

http://git-wip-us.apache.org/repos/asf/mesos/blob/d10fd9b8/src/checks/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/src/checks/CMakeLists.txt b/src/checks/CMakeLists.txt
index 4854b27..a3a6aed 100644
--- a/src/checks/CMakeLists.txt
+++ b/src/checks/CMakeLists.txt
@@ -14,32 +14,7 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-# THE MESOS TCP CONNECT SOURCE.
-###############################
-set(MESOS_TCP_CONNECT_SRC
-  ${MESOS_TCP_CONNECT_SRC}
-  tcp_connect.cpp
-  )
-
-# INCLUDE DIRECTIVES FOR MESOS TCP CONNECT EXECUTABLE (generates, e.g.,
-# -I/path/to/thing on Linux).
-#######################################################################
-include_directories(${AGENT_INCLUDE_DIRS})
-
-# LINKING LIBRARIES BY DIRECTORY (might generate, e.g., -L/path/to/thing on
-# Linux).
-###########################################################################
-link_directories(${AGENT_LIB_DIRS})
-
 # THE MESOS TCP CONNECT EXECUTABLE.
 ###################################
-add_executable(${MESOS_TCP_CONNECT} ${MESOS_TCP_CONNECT_SRC})
-
-# ADD LINKER FLAGS (generates, e.g., -lglog on Linux).
-######################################################
-target_link_libraries(${MESOS_TCP_CONNECT} ${AGENT_LIBS} ${MESOS_LIBS_TARGET})
-
-# ADD BINARY DEPENDENCIES (tells CMake what to compile/build first).
-####################################################################
-add_dependencies(${MESOS_TARGET} ${MESOS_TCP_CONNECT})
-add_dependencies(${MESOS_TCP_CONNECT} ${MESOS_LIBS_TARGET})
+add_executable(mesos-tcp-connect tcp_connect.cpp)
+target_link_libraries(mesos-tcp-connect PRIVATE mesos)

http://git-wip-us.apache.org/repos/asf/mesos/blob/d10fd9b8/src/cli/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/src/cli/CMakeLists.txt b/src/cli/CMakeLists.txt
index 056d1d7..06d9e62 100644
--- a/src/cli/CMakeLists.txt
+++ b/src/cli/CMakeLists.txt
@@ -16,28 +16,9 @@
 
 # TODO(josephw): Enable this on Windows after sorting out the dependencies.
 if (NOT WIN32)
-
-set(MESOS_EXECUTE_TARGET mesos-execute
-  CACHE STRING "Utility used to schedule and run a command in a mesos cluster.")
-
-# THE MESOS-EXECUTE SOURCE.
-###########################
-set(MESOS_EXECUTE_SRC
-  ${MESOS_EXECUTE_SRC}
-  execute.cpp
-  )
-
-# THE MESOS EXECUTE.
-#######################
-add_executable(${MESOS_EXECUTE_TARGET} ${MESOS_EXECUTE_SRC})
-
-# ADD LINKER FLAGS (generates, e.g., -lglog on Linux).
-######################################################
-target_link_libraries(${MESOS_EXECUTE_TARGET} ${MESOS_LIBS_TARGET})
-
-# ADD BINARY DEPENDENCIES (tells CMake what to compile/build first).
-####################################################################
-add_dependencies(${MESOS_TARGET} ${MESOS_EXECUTE_TARGET})
-add_dependencies(${MESOS_EXECUTE_TARGET} ${MESOS_LIBS_TARGET})
-
+  # THE MESOS EXECUTE.
+  # Utility used to schedule and run a command in a mesos cluster.
+  ################################################################
+  add_executable(mesos-execute execute.cpp)
+  target_link_libraries(mesos-execute PRIVATE mesos)
 endif ()

http://git-wip-us.apache.org/repos/asf/mesos/blob/d10fd9b8/src/docker/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/src/docker/CMakeLists.txt b/src/docker/CMakeLists.txt
index 2d7c30d..1196664 100644
--- a/src/docker/CMakeLists.txt
+++ b/src/docker/CMakeLists.txt
@@ -14,34 +14,7 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-
-# THE DOCKER EXECUTOR SOURCE.
-#############################
-set(DOCKER_EXECUTOR_SRC
-  ${DOCKER_EXECUTOR_SRC}
-  executor.cpp
-  )
-
-# INCLUDE DIRECTIVES FOR DOCKER EXECUTOR EXECUTABLE (generates, e.g.,
-# -I/path/to/thing on Linux).
-#####################################################################
-include_directories(SYSTEM ${AGENT_3RDPARTY_INCLUDE_DIRS})
-include_directories(${AGENT_INCLUDE_DIRS})
-
-# LINKING LIBRARIES BY DIRECTORY (might generate, e.g., -L/path/to/thing on
-# Linux).
-###########################################################################
-link_directories(${AGENT_LIB_DIRS})
-
 # THE DOCKER EXECUTOR EXECUTABLE.
 #################################
-add_executable(${MESOS_DOCKER_EXECUTOR} ${DOCKER_EXECUTOR_SRC})
-
-# ADD LINKER FLAGS (generates, e.g., -lglog on Linux).
-######################################################
-target_link_libraries(${MESOS_DOCKER_EXECUTOR} ${AGENT_LIBS} ${MESOS_LIBS_TARGET})
-
-# ADD BINARY DEPENDENCIES (tells CMake what to compile/build first).
-####################################################################
-add_dependencies(${MESOS_TARGET} ${MESOS_DOCKER_EXECUTOR})
-add_dependencies(${MESOS_DOCKER_EXECUTOR} ${MESOS_LIBS_TARGET})
+add_executable(mesos-docker-executor executor.cpp)
+target_link_libraries(mesos-docker-executor PRIVATE mesos)

http://git-wip-us.apache.org/repos/asf/mesos/blob/d10fd9b8/src/examples/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/src/examples/CMakeLists.txt b/src/examples/CMakeLists.txt
index e8b7ea4..d4f1af4 100644
--- a/src/examples/CMakeLists.txt
+++ b/src/examples/CMakeLists.txt
@@ -14,145 +14,72 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-# Test module sources.
-######################
-set(TEST_ALLOCATOR_SRC          test_allocator_module.cpp)
-set(TEST_ANONYMOUS_SRC          test_anonymous_module.cpp)
-set(TEST_AUTHENTICATION_SRC     test_authentication_modules.cpp)
-set(TEST_AUTHORIZER_SRC         test_authorizer_module.cpp)
-set(TEST_CONTAINER_LOGGER_SRC   test_container_logger_module.cpp)
-set(TEST_EXAMPLEMODULE_SRC      example_module_impl.cpp)
-set(TEST_HOOK_SRC               test_hook_module.cpp)
-set(TEST_HTTPAUTHENTICATOR_SRC  test_http_authenticator_module.cpp)
-set(TEST_ISOLATOR_SRC           test_isolator_module.cpp)
-set(TEST_MASTER_CONTENDER_SRC   test_master_contender_module.cpp)
-set(TEST_MASTER_DETECTOR_SRC    test_master_detector_module.cpp)
-set(TEST_QOS_CONTROLLER_SRC     test_qos_controller_module.cpp)
-set(TEST_RESOURCE_ESTIMATOR_SRC test_resource_estimator_module.cpp)
-
-
-# Example framework and executor sources.
-#########################################
-set(BALLOON_EXECUTOR_SRC              balloon_executor.cpp)
-set(BALLOON_FRAMEWORK_SRC             balloon_framework.cpp)
-set(DISK_FULL_FRAMEWORK_SRC           disk_full_framework.cpp)
-set(DOCKER_NO_EXECUTOR_FRAMEWORK_SRC  docker_no_executor_framework.cpp)
-set(DYNAMIC_RESERVATION_FRAMEWORK_SRC dynamic_reservation_framework.cpp)
-set(LOAD_GENERATOR_FRAMEWORK_SRC      load_generator_framework.cpp)
-set(LONG_LIVED_EXECUTOR_SRC           long_lived_executor.cpp)
-set(LONG_LIVED_FRAMEWORK_SRC          long_lived_framework.cpp)
-set(NO_EXECUTOR_FRAMEWORK_SRC         no_executor_framework.cpp)
-set(PERSISTENT_VOLUME_FRAMEWORK_SRC   persistent_volume_framework.cpp)
-set(TEST_EXECUTOR_SRC                 test_executor.cpp)
-set(TEST_FRAMEWORK_SRC                test_framework.cpp)
-set(TEST_HTTP_EXECUTOR_SRC            test_http_executor.cpp)
-set(TEST_HTTP_FRAMEWORK_SRC           test_http_framework.cpp)
-
-
-# Build the test modules.
-#########################
-# NOTE: Modules are not supported on Windows.
-if (NOT WIN32)
-  add_library(${TEST_ALLOCATOR}          SHARED EXCLUDE_FROM_ALL ${TEST_ALLOCATOR_SRC})
-  add_library(${TEST_ANONYMOUS}          SHARED EXCLUDE_FROM_ALL ${TEST_ANONYMOUS_SRC})
-  add_library(${TEST_AUTHENTICATION}     SHARED EXCLUDE_FROM_ALL ${TEST_AUTHENTICATION_SRC})
-  add_library(${TEST_AUTHORIZER}         SHARED EXCLUDE_FROM_ALL ${TEST_AUTHORIZER_SRC})
-  add_library(${TEST_CONTAINER_LOGGER}   SHARED EXCLUDE_FROM_ALL ${TEST_CONTAINER_LOGGER_SRC})
-  add_library(${TEST_EXAMPLEMODULE}      SHARED EXCLUDE_FROM_ALL ${TEST_EXAMPLEMODULE_SRC})
-  add_library(${TEST_HOOK}               SHARED EXCLUDE_FROM_ALL ${TEST_HOOK_SRC})
-  add_library(${TEST_HTTPAUTHENTICATOR}  SHARED EXCLUDE_FROM_ALL ${TEST_HTTPAUTHENTICATOR_SRC})
-  add_library(${TEST_ISOLATOR}           SHARED EXCLUDE_FROM_ALL ${TEST_ISOLATOR_SRC})
-  add_library(${TEST_MASTER_CONTENDER}   SHARED EXCLUDE_FROM_ALL ${TEST_MASTER_CONTENDER_SRC})
-  add_library(${TEST_MASTER_DETECTOR}    SHARED EXCLUDE_FROM_ALL ${TEST_MASTER_DETECTOR_SRC})
-  add_library(${TEST_QOS_CONTROLLER}     SHARED EXCLUDE_FROM_ALL ${TEST_QOS_CONTROLLER_SRC})
-  add_library(${TEST_RESOURCE_ESTIMATOR} SHARED EXCLUDE_FROM_ALL ${TEST_RESOURCE_ESTIMATOR_SRC})
-endif ()
-
-
-# Build the example frameworks and executors.
-#############################################
-# TODO(josephw): The scheduler driver is current not built on Windows.
 if (NOT WIN32)
-  add_executable(${BALLOON_EXECUTOR}              ${BALLOON_EXECUTOR_SRC})
-  add_executable(${BALLOON_FRAMEWORK}             ${BALLOON_FRAMEWORK_SRC})
-  add_executable(${DISK_FULL_FRAMEWORK}           ${DISK_FULL_FRAMEWORK_SRC})
-  add_executable(${DOCKER_NO_EXECUTOR_FRAMEWORK}  ${DOCKER_NO_EXECUTOR_FRAMEWORK_SRC})
-  add_executable(${DYNAMIC_RESERVATION_FRAMEWORK} ${DYNAMIC_RESERVATION_FRAMEWORK_SRC})
-  add_executable(${LOAD_GENERATOR_FRAMEWORK}      ${LOAD_GENERATOR_FRAMEWORK_SRC})
-  add_executable(${LONG_LIVED_EXECUTOR}           ${LONG_LIVED_EXECUTOR_SRC})
-  add_executable(${LONG_LIVED_FRAMEWORK}          ${LONG_LIVED_FRAMEWORK_SRC})
-  add_executable(${NO_EXECUTOR_FRAMEWORK}         ${NO_EXECUTOR_FRAMEWORK_SRC})
-  add_executable(${PERSISTENT_VOLUME_FRAMEWORK}   ${PERSISTENT_VOLUME_FRAMEWORK_SRC})
-  add_executable(${TEST_EXECUTOR}                 ${TEST_EXECUTOR_SRC})
-  add_executable(${TEST_FRAMEWORK}                ${TEST_FRAMEWORK_SRC})
-  add_executable(${TEST_HTTP_EXECUTOR}            ${TEST_HTTP_EXECUTOR_SRC})
-  add_executable(${TEST_HTTP_FRAMEWORK}           ${TEST_HTTP_FRAMEWORK_SRC})
-endif ()
+  # Build the test modules.
+  #########################
+  # NOTE: Modules are not supported on Windows.
+  add_library(testallocator          SHARED EXCLUDE_FROM_ALL test_allocator_module.cpp)
+  add_library(testanonymous          SHARED EXCLUDE_FROM_ALL test_anonymous_module.cpp)
+  add_library(testauthentication     SHARED EXCLUDE_FROM_ALL test_authentication_modules.cpp)
+  add_library(testauthorizer         SHARED EXCLUDE_FROM_ALL test_authorizer_module.cpp)
+  add_library(testcontainer_logger   SHARED EXCLUDE_FROM_ALL test_container_logger_module.cpp)
+  add_library(examplemodule          SHARED EXCLUDE_FROM_ALL example_module_impl.cpp)
+  add_library(testhook               SHARED EXCLUDE_FROM_ALL test_hook_module.cpp)
+  add_library(testhttpauthenticator  SHARED EXCLUDE_FROM_ALL test_http_authenticator_module.cpp)
+  add_library(testisolator           SHARED EXCLUDE_FROM_ALL test_isolator_module.cpp)
+  add_library(testmastercontender    SHARED EXCLUDE_FROM_ALL test_master_contender_module.cpp)
+  add_library(testmasterdetector     SHARED EXCLUDE_FROM_ALL test_master_detector_module.cpp)
+  add_library(testqos_controller     SHARED EXCLUDE_FROM_ALL test_qos_controller_module.cpp)
+  add_library(testresource_estimator SHARED EXCLUDE_FROM_ALL test_resource_estimator_module.cpp)
 
 
-# ADD LINKER FLAGS (generates, e.g., -lglog on Linux).
-######################################################
-if (NOT WIN32)
-  target_link_libraries(${TEST_ALLOCATOR}          ${MESOS_LIBS_TARGET})
-  target_link_libraries(${TEST_ANONYMOUS}          ${MESOS_LIBS_TARGET})
-  target_link_libraries(${TEST_AUTHENTICATION}     ${MESOS_LIBS_TARGET})
-  target_link_libraries(${TEST_AUTHORIZER}         ${MESOS_LIBS_TARGET})
-  target_link_libraries(${TEST_CONTAINER_LOGGER}   ${MESOS_LIBS_TARGET})
-  target_link_libraries(${TEST_EXAMPLEMODULE}      ${MESOS_LIBS_TARGET})
-  target_link_libraries(${TEST_HOOK}               ${MESOS_LIBS_TARGET})
-  target_link_libraries(${TEST_HTTPAUTHENTICATOR}  ${MESOS_LIBS_TARGET})
-  target_link_libraries(${TEST_ISOLATOR}           ${MESOS_LIBS_TARGET})
-  target_link_libraries(${TEST_MASTER_CONTENDER}   ${MESOS_LIBS_TARGET})
-  target_link_libraries(${TEST_MASTER_DETECTOR}    ${MESOS_LIBS_TARGET})
-  target_link_libraries(${TEST_QOS_CONTROLLER}     ${MESOS_LIBS_TARGET})
-  target_link_libraries(${TEST_RESOURCE_ESTIMATOR} ${MESOS_LIBS_TARGET})
+  # Build the example frameworks and executors.
+  #############################################
+  # TODO(josephw): The scheduler driver is current not built on Windows.
+  add_executable(balloon-executor              balloon_executor.cpp)
+  add_executable(balloon-framework             balloon_framework.cpp)
+  add_executable(disk-full-framework           disk_full_framework.cpp)
+  add_executable(docker-no-executor-framework  docker_no_executor_framework.cpp)
+  add_executable(dynamic-reservation-framework dynamic_reservation_framework.cpp)
+  add_executable(load-generator-framework      load_generator_framework.cpp)
+  add_executable(long-lived-executor           long_lived_executor.cpp)
+  add_executable(long-lived-framework          long_lived_framework.cpp)
+  add_executable(no-executor-framework         no_executor_framework.cpp)
+  add_executable(persistent-volume-framework   persistent_volume_framework.cpp)
+  add_executable(test-executor                 test_executor.cpp)
+  add_executable(test-framework                test_framework.cpp)
+  add_executable(test-http-executor            test_http_executor.cpp)
+  add_executable(test-http-framework           test_http_framework.cpp)
 
-  target_link_libraries(${BALLOON_EXECUTOR}              ${MESOS_LIBS_TARGET})
-  target_link_libraries(${BALLOON_FRAMEWORK}             ${MESOS_LIBS_TARGET})
-  target_link_libraries(${DISK_FULL_FRAMEWORK}           ${MESOS_LIBS_TARGET})
-  target_link_libraries(${DOCKER_NO_EXECUTOR_FRAMEWORK}  ${MESOS_LIBS_TARGET})
-  target_link_libraries(${DYNAMIC_RESERVATION_FRAMEWORK} ${MESOS_LIBS_TARGET})
-  target_link_libraries(${LOAD_GENERATOR_FRAMEWORK}      ${MESOS_LIBS_TARGET})
-  target_link_libraries(${LONG_LIVED_EXECUTOR}           ${MESOS_LIBS_TARGET})
-  target_link_libraries(${LONG_LIVED_FRAMEWORK}          ${MESOS_LIBS_TARGET})
-  target_link_libraries(${NO_EXECUTOR_FRAMEWORK}         ${MESOS_LIBS_TARGET})
-  target_link_libraries(${PERSISTENT_VOLUME_FRAMEWORK}   ${MESOS_LIBS_TARGET})
-  target_link_libraries(${TEST_EXECUTOR}                 ${MESOS_LIBS_TARGET})
-  target_link_libraries(${TEST_FRAMEWORK}                ${MESOS_LIBS_TARGET})
-  target_link_libraries(${TEST_HTTP_EXECUTOR}            ${MESOS_LIBS_TARGET})
-  target_link_libraries(${TEST_HTTP_FRAMEWORK}           ${MESOS_LIBS_TARGET})
-endif ()
-
-
-# ADD BINARY DEPENDENCIES (tells CMake what to compile/build first).
-####################################################################
-if (NOT WIN32)
-  add_dependencies(${TEST_ALLOCATOR}          ${MESOS_LIBS_TARGET})
-  add_dependencies(${TEST_ANONYMOUS}          ${MESOS_LIBS_TARGET})
-  add_dependencies(${TEST_AUTHENTICATION}     ${MESOS_LIBS_TARGET})
-  add_dependencies(${TEST_AUTHORIZER}         ${MESOS_LIBS_TARGET})
-  add_dependencies(${TEST_CONTAINER_LOGGER}   ${MESOS_LIBS_TARGET})
-  add_dependencies(${TEST_EXAMPLEMODULE}      ${MESOS_LIBS_TARGET})
-  add_dependencies(${TEST_HOOK}               ${MESOS_LIBS_TARGET})
-  add_dependencies(${TEST_HTTPAUTHENTICATOR}  ${MESOS_LIBS_TARGET})
-  add_dependencies(${TEST_ISOLATOR}           ${MESOS_LIBS_TARGET})
-  add_dependencies(${TEST_MASTER_CONTENDER}   ${MESOS_LIBS_TARGET})
-  add_dependencies(${TEST_MASTER_DETECTOR}    ${MESOS_LIBS_TARGET})
-  add_dependencies(${TEST_QOS_CONTROLLER}     ${MESOS_LIBS_TARGET})
-  add_dependencies(${TEST_RESOURCE_ESTIMATOR} ${MESOS_LIBS_TARGET})
+  # NOTE: Do not replace this with `link_libraries()`. While it may result in
+  # less code, it is deprecated and relies on side effects instead of
+  # explicitness.
+  target_link_libraries(testallocator          PRIVATE mesos)
+  target_link_libraries(testanonymous          PRIVATE mesos)
+  target_link_libraries(testauthentication     PRIVATE mesos)
+  target_link_libraries(testauthorizer         PRIVATE mesos)
+  target_link_libraries(testcontainer_logger   PRIVATE mesos)
+  target_link_libraries(examplemodule          PRIVATE mesos)
+  target_link_libraries(testhook               PRIVATE mesos)
+  target_link_libraries(testhttpauthenticator  PRIVATE mesos)
+  target_link_libraries(testisolator           PRIVATE mesos)
+  target_link_libraries(testmastercontender    PRIVATE mesos)
+  target_link_libraries(testmasterdetector     PRIVATE mesos)
+  target_link_libraries(testqos_controller     PRIVATE mesos)
+  target_link_libraries(testresource_estimator PRIVATE mesos)
 
-  add_dependencies(${BALLOON_EXECUTOR}              ${MESOS_LIBS_TARGET})
-  add_dependencies(${BALLOON_FRAMEWORK}             ${MESOS_LIBS_TARGET})
-  add_dependencies(${DISK_FULL_FRAMEWORK}           ${MESOS_LIBS_TARGET})
-  add_dependencies(${DOCKER_NO_EXECUTOR_FRAMEWORK}  ${MESOS_LIBS_TARGET})
-  add_dependencies(${DYNAMIC_RESERVATION_FRAMEWORK} ${MESOS_LIBS_TARGET})
-  add_dependencies(${LOAD_GENERATOR_FRAMEWORK}      ${MESOS_LIBS_TARGET})
-  add_dependencies(${LONG_LIVED_EXECUTOR}           ${MESOS_LIBS_TARGET})
-  add_dependencies(${LONG_LIVED_FRAMEWORK}          ${MESOS_LIBS_TARGET})
-  add_dependencies(${NO_EXECUTOR_FRAMEWORK}         ${MESOS_LIBS_TARGET})
-  add_dependencies(${PERSISTENT_VOLUME_FRAMEWORK}   ${MESOS_LIBS_TARGET})
-  add_dependencies(${TEST_EXECUTOR}                 ${MESOS_LIBS_TARGET})
-  add_dependencies(${TEST_FRAMEWORK}                ${MESOS_LIBS_TARGET})
-  add_dependencies(${TEST_HTTP_EXECUTOR}            ${MESOS_LIBS_TARGET})
-  add_dependencies(${TEST_HTTP_FRAMEWORK}           ${MESOS_LIBS_TARGET})
+  target_link_libraries(balloon-executor              PRIVATE mesos)
+  target_link_libraries(balloon-framework             PRIVATE mesos)
+  target_link_libraries(disk-full-framework           PRIVATE mesos)
+  target_link_libraries(docker-no-executor-framework  PRIVATE mesos)
+  target_link_libraries(dynamic-reservation-framework PRIVATE mesos)
+  target_link_libraries(load-generator-framework      PRIVATE mesos)
+  target_link_libraries(long-lived-executor           PRIVATE mesos)
+  target_link_libraries(long-lived-framework          PRIVATE mesos)
+  target_link_libraries(no-executor-framework         PRIVATE mesos)
+  target_link_libraries(persistent-volume-framework   PRIVATE mesos)
+  target_link_libraries(test-executor                 PRIVATE mesos)
+  target_link_libraries(test-framework                PRIVATE mesos)
+  target_link_libraries(test-http-executor            PRIVATE mesos)
+  target_link_libraries(test-http-framework           PRIVATE mesos)
 endif ()

http://git-wip-us.apache.org/repos/asf/mesos/blob/d10fd9b8/src/examples/cmake/ExamplesConfigure.cmake
----------------------------------------------------------------------
diff --git a/src/examples/cmake/ExamplesConfigure.cmake b/src/examples/cmake/ExamplesConfigure.cmake
deleted file mode 100644
index d85da4e..0000000
--- a/src/examples/cmake/ExamplesConfigure.cmake
+++ /dev/null
@@ -1,51 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-#
-#     http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-# Define test module library targets.
-#####################################
-# These libraries are usually the default implementation
-# of the module pulled out into a shared library.
-set(TEST_ALLOCATOR          testallocator)
-set(TEST_ANONYMOUS          testanonymous)
-set(TEST_AUTHENTICATION     testauthentication)
-set(TEST_AUTHORIZER         testauthorizer)
-set(TEST_CONTAINER_LOGGER   testcontainer_logger)
-set(TEST_EXAMPLEMODULE      examplemodule)
-set(TEST_HOOK               testhook)
-set(TEST_HTTPAUTHENTICATOR  testhttpauthenticator)
-set(TEST_ISOLATOR           testisolator)
-set(TEST_MASTER_CONTENDER   testmastercontender)
-set(TEST_MASTER_DETECTOR    testmasterdetector)
-set(TEST_QOS_CONTROLLER     testqos_controller)
-set(TEST_RESOURCE_ESTIMATOR testresource_estimator)
-
-
-# Define example framework and executor targets.
-################################################
-set(BALLOON_EXECUTOR              balloon-executor)
-set(BALLOON_FRAMEWORK             balloon-framework)
-set(DISK_FULL_FRAMEWORK           disk-full-framework)
-set(DOCKER_NO_EXECUTOR_FRAMEWORK  docker-no-executor-framework)
-set(DYNAMIC_RESERVATION_FRAMEWORK dynamic-reservation-framework)
-set(LOAD_GENERATOR_FRAMEWORK      load-generator-framework)
-set(LONG_LIVED_EXECUTOR           long-lived-executor)
-set(LONG_LIVED_FRAMEWORK          long-lived-framework)
-set(NO_EXECUTOR_FRAMEWORK         no-executor-framework)
-set(PERSISTENT_VOLUME_FRAMEWORK   persistent-volume-framework)
-set(TEST_EXECUTOR                 test-executor)
-set(TEST_FRAMEWORK                test-framework)
-set(TEST_HTTP_EXECUTOR            test-http-executor)
-set(TEST_HTTP_FRAMEWORK           test-http-framework)

http://git-wip-us.apache.org/repos/asf/mesos/blob/d10fd9b8/src/launcher/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/src/launcher/CMakeLists.txt b/src/launcher/CMakeLists.txt
index 97edc4a..c7a83d4 100644
--- a/src/launcher/CMakeLists.txt
+++ b/src/launcher/CMakeLists.txt
@@ -14,52 +14,15 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-# THE MESOS LAUNCHER EXECUTOR SOURCE.
-#####################################
-set(DEFAULT_EXECUTOR_SRC
-  ${DEFAULT_EXECUTOR_SRC}
-  default_executor.cpp
-  )
-
-set(EXECUTOR_EXECUTABLE_SRC
-  ${EXECUTOR_EXECUTABLE_SRC}
-  executor.cpp
-  )
-
-# THE MESOS LAUNCHER FETCHER SOURCE.
-####################################
-set(FETCHER_EXECUTABLE_SRC fetcher.cpp)
-
 # THE LAUNCHER EXECUTOR AND FETCHER EXECUTABLES.
 ################################################
-add_executable(${DEFAULT_EXECUTOR_TARGET} ${DEFAULT_EXECUTOR_SRC})
-add_executable(${MESOS_EXECUTOR} ${EXECUTOR_EXECUTABLE_SRC})
-
-if (NOT WIN32)
-  add_executable(${MESOS_FETCHER} ${FETCHER_EXECUTABLE_SRC})
-endif ()
-
-# ADD LINKER FLAGS (generates, e.g., -lglog on Linux).
-######################################################
-target_link_libraries(${DEFAULT_EXECUTOR_TARGET} ${MESOS_LIBS_TARGET})
-target_link_libraries(${MESOS_EXECUTOR} ${MESOS_LIBS_TARGET})
-
-if (NOT WIN32)
-  target_link_libraries(${MESOS_FETCHER} ${MESOS_LIBS_TARGET})
-endif ()
-
-# ADD BINARY DEPENDENCIES (tells CMake what to compile/build first).
-####################################################################
-add_dependencies(
-  ${MESOS_TARGET}
-  ${DEFAULT_EXECUTOR_TARGET}
-  ${MESOS_EXECUTOR}
-  )
+add_executable(mesos-default-executor default_executor.cpp)
+target_link_libraries(mesos-default-executor PRIVATE mesos)
 
-add_dependencies(${DEFAULT_EXECUTOR_TARGET} ${MESOS_LIBS_TARGET})
-add_dependencies(${MESOS_EXECUTOR}          ${MESOS_LIBS_TARGET})
+add_executable(mesos-executor executor.cpp)
+target_link_libraries(mesos-executor PRIVATE mesos)
 
 if (NOT WIN32)
-  add_dependencies(${MESOS_TARGET} ${MESOS_FETCHER})
-  add_dependencies(${MESOS_FETCHER} ${MESOS_LIBS_TARGET})
+  add_executable(mesos-fetcher fetcher.cpp)
+  target_link_libraries(mesos-fetcher PRIVATE mesos)
 endif ()

http://git-wip-us.apache.org/repos/asf/mesos/blob/d10fd9b8/src/local/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/src/local/CMakeLists.txt b/src/local/CMakeLists.txt
index 7c9a718..5e5bee3 100644
--- a/src/local/CMakeLists.txt
+++ b/src/local/CMakeLists.txt
@@ -16,28 +16,9 @@
 
 # TODO(josephw): Enable this on Windows after sorting out the dependencies.
 if (NOT WIN32)
-
-set(MESOS_LOCAL_TARGET mesos-local
-  CACHE STRING "Used to start a local mesos cluster for testing purposes.")
-
-# THE MESOS-LOCAL SOURCE.
-#########################
-set(MESOS_LOCAL_SRC
-  ${MESOS_LOCAL_SRC}
-  main.cpp
-  )
-
-# THE MESOS LOCAL EXECUTABLE.
-#############################
-add_executable(${MESOS_LOCAL_TARGET} ${MESOS_LOCAL_SRC})
-
-# ADD LINKER FLAGS (generates, e.g., -lglog on Linux).
-######################################################
-target_link_libraries(${MESOS_LOCAL_TARGET} ${MESOS_LIBS_TARGET})
-
-# ADD BINARY DEPENDENCIES (tells CMake what to compile/build first).
-####################################################################
-add_dependencies(${MESOS_TARGET} ${MESOS_LOCAL_TARGET})
-add_dependencies(${MESOS_LOCAL_TARGET} ${MESOS_LIBS_TARGET})
-
+  # THE MESOS LOCAL EXECUTABLE.
+  # Used to start a local mesos cluster for testing purposes.
+  ###########################################################
+  add_executable(mesos-local main.cpp)
+  target_link_libraries(mesos-local PRIVATE mesos)
 endif ()

http://git-wip-us.apache.org/repos/asf/mesos/blob/d10fd9b8/src/log/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/src/log/CMakeLists.txt b/src/log/CMakeLists.txt
index 2fad6cc..1c94470 100644
--- a/src/log/CMakeLists.txt
+++ b/src/log/CMakeLists.txt
@@ -16,28 +16,9 @@
 
 # TODO(josephw): Enable this on Windows after sorting out the dependencies.
 if (NOT WIN32)
-
-set(MESOS_LOG_TARGET mesos-log
-  CACHE STRING "Utility used to interact with the replicated log.")
-
-# THE MESOS-LOG SOURCE.
-###########################
-set(MESOS_LOG_SRC
-  ${MESOS_LOG_SRC}
-  main.cpp
-  )
-
-# THE MESOS LOG.
-###########################################
-add_executable(${MESOS_LOG_TARGET} ${MESOS_LOG_SRC})
-
-# ADD LINKER FLAGS (generates, e.g., -lglog on Linux).
-######################################################
-target_link_libraries(${MESOS_LOG_TARGET} ${MESOS_LIBS_TARGET})
-
-# ADD BINARY DEPENDENCIES (tells CMake what to compile/build first).
-####################################################################
-add_dependencies(${MESOS_TARGET} ${MESOS_LOG_TARGET})
-add_dependencies(${MESOS_LOG_TARGET} ${MESOS_LIBS_TARGET})
-
+  # THE MESOS LOG.
+  # Utility used to interact with the replicated log.
+  ###################################################
+  add_executable(mesos-log main.cpp)
+  target_link_libraries(mesos-log PRIVATE mesos)
 endif ()

http://git-wip-us.apache.org/repos/asf/mesos/blob/d10fd9b8/src/master/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/src/master/CMakeLists.txt b/src/master/CMakeLists.txt
index 0062fb3..ec55211 100644
--- a/src/master/CMakeLists.txt
+++ b/src/master/CMakeLists.txt
@@ -16,36 +16,8 @@
 
 # TODO(josephw): Enable this on Windows after sorting out the dependencies.
 if (NOT WIN32)
-
-# THE MASTER SOURCE.
-###################
-set(MASTER_EXECUTABLE_SRC
-  ${MASTER_EXECUTABLE_SRC}
-  main.cpp
-  )
-
-# INCLUDE DIRECTIVES FOR MASTER EXECUTABLE (generates, e.g., -I/path/to/thing
-# on Linux).
-############################################################################
-include_directories(SYSTEM ${MASTER_3RDPARTY_INCLUDE_DIRS})
-include_directories(${MASTER_INCLUDE_DIRS})
-
-# LINKING LIBRARIES BY DIRECTORY (might generate, e.g., -L/path/to/thing on
-# Linux).
-###########################################################################
-link_directories(${MASTER_LIB_DIRS})
-
-# THE MASTER EXECUTABLE.
-#######################
-add_executable(${MESOS_MASTER} ${MASTER_EXECUTABLE_SRC})
-
-# ADD LINKER FLAGS (generates, e.g., -lglog on Linux).
-######################################################
-target_link_libraries(${MESOS_MASTER} ${MASTER_LIBS} ${MESOS_LIBS_TARGET})
-
-# ADD BINARY DEPENDENCIES (tells CMake what to compile/build first).
-####################################################################
-add_dependencies(${MESOS_TARGET} ${MESOS_MASTER})
-add_dependencies(${MESOS_MASTER} ${MESOS_LIBS_TARGET})
-
+  # THE MASTER EXECUTABLE.
+  ########################
+  add_executable(mesos-master main.cpp)
+  target_link_libraries(mesos-master PRIVATE mesos)
 endif ()

http://git-wip-us.apache.org/repos/asf/mesos/blob/d10fd9b8/src/master/cmake/MasterConfigure.cmake
----------------------------------------------------------------------
diff --git a/src/master/cmake/MasterConfigure.cmake b/src/master/cmake/MasterConfigure.cmake
deleted file mode 100644
index a5fbc45..0000000
--- a/src/master/cmake/MasterConfigure.cmake
+++ /dev/null
@@ -1,69 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-#
-#     http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-# TODO(andschwa): Import this properly.
-set(SASL_LFLAG sasl2)
-
-# Define process library dependencies. Tells the process library build targets
-# download/configure/build all third-party libraries before attempting to build.
-################################################################################
-set(MASTER_DEPENDENCIES
-  ${MASTER_DEPENDENCIES}
-  make_bin_include_dir
-  make_bin_src_dir
-  )
-
-# Define third-party include directories. Tells compiler toolchain where to get
-# headers for our third party libs (e.g., -I/path/to/glog on Linux).
-###############################################################################
-set(MASTER_INCLUDE_DIRS
-  ${MASTER_INCLUDE_DIRS}
-  ${MESOS_PUBLIC_INCLUDE_DIR}
-  # Contains (e.g.) compiled *.pb.h files.
-  ${MESOS_BIN_INCLUDE_DIR}
-  ${MESOS_BIN_INCLUDE_DIR}/mesos
-  ${MESOS_BIN_SRC_DIR}
-  ${MESOS_SRC_DIR}
-  )
-
-set(MASTER_3RDPARTY_INCLUDE_DIRS
-  ${MASTER_3RDPARTY_INCLUDE_DIRS}
-  )
-
-# Define third-party lib install directories. Used to tell the compiler
-# toolchain where to find our third party libs (e.g., -L/path/to/glog on
-# Linux).
-########################################################################
-set(MASTER_LIB_DIRS
-  ${MASTER_LIB_DIRS}
-  )
-
-# Define third-party libs. Used to generate flags that the linker uses to
-# include our third-party libs (e.g., -lglog on Linux).
-#########################################################################
-set(MASTER_LIBS
-  ${MASTER_LIBS}
-  process
-  zookeeper
-  )
-
-if (NOT WIN32)
-  set(MASTER_LIBS
-    ${MASTER_LIBS}
-    leveldb
-    ${SASL_LFLAG}
-    )
-endif ()

http://git-wip-us.apache.org/repos/asf/mesos/blob/d10fd9b8/src/slave/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/src/slave/CMakeLists.txt b/src/slave/CMakeLists.txt
index 9dbadca..6f08f3d 100644
--- a/src/slave/CMakeLists.txt
+++ b/src/slave/CMakeLists.txt
@@ -14,37 +14,12 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-# THE AGENT SOURCE.
-###################
-set(AGENT_EXECUTABLE_SRC
-  ${AGENT_EXECUTABLE_SRC}
-  main.cpp
-  )
-
 add_subdirectory(container_loggers)
 add_subdirectory(qos_controllers)
 add_subdirectory(resource_estimators)
 
-# INCLUDE DIRECTIVES FOR AGENT EXECUTABLE (generates, e.g., -I/path/to/thing
-# on Linux).
-############################################################################
-include_directories(SYSTEM ${AGENT_3RDPARTY_INCLUDE_DIRS})
-include_directories(${AGENT_INCLUDE_DIRS})
-
-# LINKING LIBRARIES BY DIRECTORY (might generate, e.g., -L/path/to/thing on
-# Linux).
-###########################################################################
-link_directories(${AGENT_LIB_DIRS})
 
 # THE AGENT EXECUTABLE.
 #######################
-add_executable(${AGENT_TARGET} ${AGENT_EXECUTABLE_SRC})
-
-# ADD LINKER FLAGS (generates, e.g., -lglog on Linux).
-######################################################
-target_link_libraries(${AGENT_TARGET} ${AGENT_LIBS} ${MESOS_LIBS_TARGET})
-
-# ADD BINARY DEPENDENCIES (tells CMake what to compile/build first).
-####################################################################
-add_dependencies(${MESOS_TARGET} ${AGENT_TARGET})
-add_dependencies(${AGENT_TARGET} ${MESOS_LIBS_TARGET})
+add_executable(mesos-agent main.cpp)
+target_link_libraries(mesos-agent PRIVATE mesos)

http://git-wip-us.apache.org/repos/asf/mesos/blob/d10fd9b8/src/slave/cmake/AgentConfigure.cmake
----------------------------------------------------------------------
diff --git a/src/slave/cmake/AgentConfigure.cmake b/src/slave/cmake/AgentConfigure.cmake
deleted file mode 100644
index 4a06a4b..0000000
--- a/src/slave/cmake/AgentConfigure.cmake
+++ /dev/null
@@ -1,85 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-#
-#     http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-# TODO(andschwa): Import this properly.
-set(SASL_LFLAG sasl2)
-
-set(LOGROTATE_CONTAINER_LOGGER_TARGET logrotate_container_logger
-  CACHE STRING "Library containing the logrotate container logger."
-  )
-
-set(MESOS_LOGROTATE_LOGGER_TARGET mesos-logrotate-logger
-  CACHE STRING "Executable used by the logrotate container logger."
-  )
-
-set(QOS_CONTROLLER_TARGET load_qos_controller
-  CACHE STRING "Library containing the load qos controller."
-  )
-
-set(RESOURCE_ESTIMATOR_TARGET fixed_resource_estimator
-  CACHE STRING "Library containing the fixed resource estimator."
-  )
-
-# Define process library dependencies. Tells the process library build targets
-# download/configure/build all third-party libraries before attempting to build.
-################################################################################
-set(AGENT_DEPENDENCIES
-  ${AGENT_DEPENDENCIES}
-  make_bin_include_dir
-  make_bin_src_dir
-  )
-
-# Define third-party include directories. Tells compiler toolchain where to get
-# headers for our third party libs (e.g., -I/path/to/glog on Linux).
-###############################################################################
-set(AGENT_INCLUDE_DIRS
-  ${AGENT_INCLUDE_DIRS}
-  ${MESOS_PUBLIC_INCLUDE_DIR}
-  # Contains (e.g.) compiled *.pb.h files.
-  ${MESOS_BIN_INCLUDE_DIR}
-  ${MESOS_BIN_INCLUDE_DIR}/mesos
-  ${MESOS_BIN_SRC_DIR}
-  ${MESOS_SRC_DIR}
-  )
-
-set(AGENT_3RDPARTY_INCLUDE_DIRS
-  ${AGENT_3RDPARTY_INCLUDE_DIRS}
-  )
-
-# Define third-party lib install directories. Used to tell the compiler
-# toolchain where to find our third party libs (e.g., -L/path/to/glog on
-# Linux).
-########################################################################
-set(AGENT_LIB_DIRS
-  ${AGENT_LIB_DIRS}
-  )
-
-# Define third-party libs. Used to generate flags that the linker uses to
-# include our third-party libs (e.g., -lglog on Linux).
-#########################################################################
-set(AGENT_LIBS
-  ${AGENT_LIBS}
-  process
-  zookeeper
-  )
-
-if (NOT WIN32)
-  set(AGENT_LIBS
-    ${AGENT_LIBS}
-    leveldb
-    ${SASL_LFLAG}
-    )
-endif ()

http://git-wip-us.apache.org/repos/asf/mesos/blob/d10fd9b8/src/slave/container_loggers/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/src/slave/container_loggers/CMakeLists.txt b/src/slave/container_loggers/CMakeLists.txt
index c0774ce..b4f79a4 100644
--- a/src/slave/container_loggers/CMakeLists.txt
+++ b/src/slave/container_loggers/CMakeLists.txt
@@ -14,36 +14,21 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-# Logrotate container logger sources.
-#####################################
-set(LOGROTATE_CONTAINER_LOGGER_SRC lib_logrotate.cpp)
-set(MESOS_LOGROTATE_LOGGER_SRC logrotate.cpp)
-
 # Build the container logger module.
 ####################################
 # NOTE: Modules are not supported on Windows.
 if (NOT WIN32)
-  add_library(${LOGROTATE_CONTAINER_LOGGER_TARGET} SHARED ${LOGROTATE_CONTAINER_LOGGER_SRC})
-  add_executable(${MESOS_LOGROTATE_LOGGER_TARGET} ${MESOS_LOGROTATE_LOGGER_SRC})
-endif ()
+  # NOTE: This library uses underscores because of a hard-coded expectation of
+  # `src/tests/module`.
+  add_library(logrotate_container_logger SHARED lib_logrotate.cpp)
+  target_link_libraries(logrotate_container_logger PRIVATE mesos)
 
-# ADD LINKER FLAGS (generates, e.g., -lglog on Linux).
-######################################################
-if (NOT WIN32)
-  target_link_libraries(${LOGROTATE_CONTAINER_LOGGER_TARGET} ${MESOS_LIBS_TARGET})
-  target_link_libraries(${MESOS_LOGROTATE_LOGGER_TARGET} ${MESOS_LIBS_TARGET})
-endif ()
-
-# ADD BINARY DEPENDENCIES (tells CMake what to compile/build first).
-####################################################################
-if (NOT WIN32)
-  add_dependencies(${MESOS_TARGET} ${LOGROTATE_CONTAINER_LOGGER_TARGET})
+  # NOTE: This does not link to the above library because this is a
+  # light-weight companion binary which can be run independently.
+  add_executable(mesos-logrotate-logger logrotate.cpp)
+  target_link_libraries(mesos-logrotate-logger PRIVATE mesos)
 
   add_dependencies(
-    ${LOGROTATE_CONTAINER_LOGGER_TARGET}
-    ${MESOS_LIBS_TARGET}
-    ${MESOS_LOGROTATE_LOGGER_TARGET}
-    )
-
-  add_dependencies(${MESOS_LOGROTATE_LOGGER_TARGET} ${MESOS_LIBS_TARGET})
+    logrotate_container_logger
+    mesos-logrotate-logger)
 endif ()

http://git-wip-us.apache.org/repos/asf/mesos/blob/d10fd9b8/src/slave/containerizer/mesos/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/src/slave/containerizer/mesos/CMakeLists.txt b/src/slave/containerizer/mesos/CMakeLists.txt
index fa2043e..ba1f92f 100644
--- a/src/slave/containerizer/mesos/CMakeLists.txt
+++ b/src/slave/containerizer/mesos/CMakeLists.txt
@@ -14,59 +14,19 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-# SOURCE FILES FOR THE CONTAINERIZER.
-#####################################
-set(CONTAINERIZER_EXECUTABLE_SRC
-  ${CONTAINERIZER_EXECUTABLE_SRC}
-  main.cpp
-  )
-
-if (NOT WIN32)
-  set(MESOS_IO_SWITCHBOARD_SRC
-    ${MESOS_IO_SWITCHBOARD_SRC}
-    io/switchboard_main.cpp
-    )
-
-  set(MESOS_CNI_PORT_MAPPER_SRC
-    ${MESOS_CNI_PORT_MAPPER_SRC}
-    isolators/network/cni/plugins/port_mapper/main.cpp
-    isolators/network/cni/plugins/port_mapper/port_mapper.cpp
-    )
-endif ()
-
 # THE CONTAINERIZER EXECUTABLE.
 ###############################
-add_executable(${MESOS_CONTAINERIZER} ${CONTAINERIZER_EXECUTABLE_SRC})
-if (NOT WIN32)
-  add_executable(${MESOS_IO_SWITCHBOARD} ${MESOS_IO_SWITCHBOARD_SRC})
-  add_executable(${MESOS_CNI_PORT_MAPPER} ${MESOS_CNI_PORT_MAPPER_SRC})
-endif ()
+add_executable(mesos-containerizer main.cpp)
+target_link_libraries(mesos-containerizer PRIVATE mesos)
 
-# ADD LINKER FLAGS (generates, e.g., -lglog on Linux).
-######################################################
-target_link_libraries(${MESOS_CONTAINERIZER}  ${AGENT_LIBS} ${MESOS_LIBS_TARGET})
 if (NOT WIN32)
-  target_link_libraries(
-    ${MESOS_IO_SWITCHBOARD}
-    ${AGENT_LIBS}
-    ${MESOS_LIBS_TARGET})
-
-  target_link_libraries(
-    ${MESOS_CNI_PORT_MAPPER}
-    ${AGENT_LIBS}
-    ${MESOS_LIBS_TARGET})
-endif ()
+  add_executable(mesos-io-switchboard io/switchboard_main.cpp)
+  target_link_libraries(mesos-io-switchboard PRIVATE mesos)
 
-# ADD BINARY DEPENDENCIES (tells CMake what to compile/build first).
-####################################################################
-add_dependencies(${MESOS_TARGET} ${MESOS_CONTAINERIZER})
-if (NOT WIN32)
-  add_dependencies(${MESOS_TARGET} ${MESOS_IO_SWITCHBOARD})
-  add_dependencies(${MESOS_TARGET} ${MESOS_CNI_PORT_MAPPER})
-endif ()
+  add_executable(
+    mesos-cni-port-mapper
+    isolators/network/cni/plugins/port_mapper/main.cpp
+    isolators/network/cni/plugins/port_mapper/port_mapper.cpp)
 
-add_dependencies(${MESOS_CONTAINERIZER} ${MESOS_LIBS_TARGET})
-if (NOT WIN32)
-  add_dependencies(${MESOS_IO_SWITCHBOARD} ${MESOS_LIBS_TARGET})
-  add_dependencies(${MESOS_CNI_PORT_MAPPER} ${MESOS_LIBS_TARGET})
+  target_link_libraries(mesos-cni-port-mapper PRIVATE mesos)
 endif ()

http://git-wip-us.apache.org/repos/asf/mesos/blob/d10fd9b8/src/slave/qos_controllers/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/src/slave/qos_controllers/CMakeLists.txt b/src/slave/qos_controllers/CMakeLists.txt
index 65ab338..ff9cc15 100644
--- a/src/slave/qos_controllers/CMakeLists.txt
+++ b/src/slave/qos_controllers/CMakeLists.txt
@@ -14,22 +14,8 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-# THE QOS_CONTROLLER SOURCE.
-############################
-set(QOS_CONTROLLER_SRC
-  ${QOS_CONTROLLER_SRC}
-  load.cpp
-  )
-
-# THE AGENT EXECUTABLE.
-#######################
-add_library(${QOS_CONTROLLER_TARGET} ${MESOS_DEFAULT_LIBRARY_LINKAGE} ${QOS_CONTROLLER_SRC})
-
-# ADD LINKER FLAGS (generates, e.g., -lglog on Linux).
-######################################################
-target_link_libraries(${QOS_CONTROLLER_TARGET} ${AGENT_LIBS} ${MESOS_LIBS_TARGET})
-
-# ADD BINARY DEPENDENCIES (tells CMake what to compile/build first).
-####################################################################
-add_dependencies(${MESOS_TARGET} ${QOS_CONTROLLER_TARGET})
-add_dependencies(${QOS_CONTROLLER_TARGET} ${MESOS_LIBS_TARGET})
+# THE LOAD QOS CONTROLLER LIBRARY.
+##################################
+# NOTE: This library uses underscores to be consistent with other modules.
+add_library(load_qos_controller load.cpp)
+target_link_libraries(load_qos_controller PRIVATE mesos)

http://git-wip-us.apache.org/repos/asf/mesos/blob/d10fd9b8/src/slave/resource_estimators/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/src/slave/resource_estimators/CMakeLists.txt b/src/slave/resource_estimators/CMakeLists.txt
index 1d28bd4..6f32421 100644
--- a/src/slave/resource_estimators/CMakeLists.txt
+++ b/src/slave/resource_estimators/CMakeLists.txt
@@ -14,22 +14,9 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-# THE RESOURCE_ESTIMATOR SOURCE.
-################################
-set(RESOURCE_ESTIMATOR_SRC
-  ${RESOURCE_ESTIMATOR_SRC}
-  fixed.cpp
-  )
-
-# THE AGENT EXECUTABLE.
-#######################
-add_library(${RESOURCE_ESTIMATOR_TARGET} ${MESOS_DEFAULT_LIBRARY_LINKAGE} ${RESOURCE_ESTIMATOR_SRC})
-
-# ADD LINKER FLAGS (generates, e.g., -lglog on Linux).
-######################################################
-target_link_libraries(${RESOURCE_ESTIMATOR_TARGET} ${AGENT_LIBS} ${MESOS_LIBS_TARGET})
-
-# ADD BINARY DEPENDENCIES (tells CMake what to compile/build first).
-####################################################################
-add_dependencies(${MESOS_TARGET} ${RESOURCE_ESTIMATOR_TARGET})
-add_dependencies(${RESOURCE_ESTIMATOR_TARGET} ${MESOS_LIBS_TARGET})
+# THE FIXED RESOURCE ESTIMATOR.
+###############################
+# NOTE: This library uses underscores because of a hard-coded expectation of
+# `src/tests/oversubscription_tests.cpp`.
+add_library(fixed_resource_estimator fixed.cpp)
+target_link_libraries(fixed_resource_estimator PRIVATE mesos)

http://git-wip-us.apache.org/repos/asf/mesos/blob/d10fd9b8/src/tests/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/src/tests/CMakeLists.txt b/src/tests/CMakeLists.txt
index 2d4eed2..c7f234b 100644
--- a/src/tests/CMakeLists.txt
+++ b/src/tests/CMakeLists.txt
@@ -14,40 +14,34 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-include(MesosTestsConfigure)
-
 # Sources for a test helper binary.
 ###################################
 set(TEST_HELPER_SRC
-  ${TEST_HELPER_SRC}
   active_user_test_helper.cpp
   flags.cpp
   http_server_test_helper.cpp
   resources_utils.cpp
   test_helper_main.cpp
-  utils.cpp
-  )
+  utils.cpp)
 
 if (NOT WIN32)
   set(TEST_HELPER_SRC
     ${TEST_HELPER_SRC}
     kill_policy_test_helper.cpp
-    containerizer/memory_test_helper.cpp
-    )
+    containerizer/memory_test_helper.cpp)
 endif ()
 
 if (LINUX)
   set(TEST_HELPER_SRC
     ${TEST_HELPER_SRC}
     containerizer/capabilities_test_helper.cpp
-    containerizer/setns_test_helper.cpp
-    )
+    containerizer/setns_test_helper.cpp)
 endif ()
 
+
 # Test utilities.
 #################
 set(MESOS_TESTS_UTILS_SRC
-  ${MESOS_TESTS_UTILS_SRC}
   active_user_test_helper.cpp
   cluster.cpp
   containerizer.cpp
@@ -63,30 +57,27 @@ set(MESOS_TESTS_UTILS_SRC
   module.cpp
   resources_utils.cpp
   utils.cpp
-  containerizer/launcher.cpp
-  )
+  containerizer/launcher.cpp)
 
 if (NOT WIN32)
   set(MESOS_TESTS_UTILS_SRC
     ${MESOS_TESTS_UTILS_SRC}
     kill_policy_test_helper.cpp
     script.cpp
-    containerizer/memory_test_helper.cpp
-    )
+    containerizer/memory_test_helper.cpp)
 endif ()
 
 if (LINUX)
   set(MESOS_TESTS_UTILS_SRC
     ${MESOS_TESTS_UTILS_SRC}
     containerizer/capabilities_test_helper.cpp
-    containerizer/setns_test_helper.cpp
-    )
+    containerizer/setns_test_helper.cpp)
 endif ()
 
+
 # All the test sources.
 #######################
 set(MESOS_TESTS_SRC
-  ${MESOS_TESTS_SRC}
   ${MESOS_TESTS_UTILS_SRC}
   anonymous_tests.cpp
   api_tests.cpp
@@ -130,8 +121,7 @@ set(MESOS_TESTS_SRC
   uri_tests.cpp
   uri_fetcher_tests.cpp
   values_tests.cpp
-  zookeeper_url_tests.cpp
-  )
+  zookeeper_url_tests.cpp)
 
 if (HAS_JAVA)
   set(MESOS_TESTS_SRC
@@ -146,22 +136,19 @@ endif ()
 if (ENABLE_SSL)
   set(MESOS_TESTS_SRC
     ${MESOS_TESTS_SRC}
-    secret_generator_tests.cpp
-    )
+    secret_generator_tests.cpp)
 endif ()
 
 set(MESOS_TESTS_SRC
   ${MESOS_TESTS_SRC}
   common/http_tests.cpp
   common/recordio_tests.cpp
-  common/type_utils_tests.cpp
-  )
+  common/type_utils_tests.cpp)
 
 set(MESOS_TESTS_SRC
   ${MESOS_TESTS_SRC}
   containerizer/containerizer_tests.cpp
-  containerizer/docker_tests.cpp
-  )
+  containerizer/docker_tests.cpp)
 
 if (NOT WIN32)
   set(MESOS_TESTS_SRC
@@ -196,13 +183,11 @@ if (NOT WIN32)
     slave_recovery_tests.cpp
     state_tests.cpp
     teardown_tests.cpp
-    upgrade_tests.cpp
-    )
+    upgrade_tests.cpp)
 
   set(MESOS_TESTS_SRC
     ${MESOS_TESTS_SRC}
-    common/command_utils_tests.cpp
-    )
+    common/command_utils_tests.cpp)
 
   set(MESOS_TESTS_SRC
     ${MESOS_TESTS_SRC}
@@ -223,8 +208,7 @@ if (NOT WIN32)
     containerizer/provisioner_backend_tests.cpp
     containerizer/provisioner_docker_tests.cpp
     containerizer/provisioner_paths_tests.cpp
-    containerizer/volume_sandbox_path_isolator_tests.cpp
-    )
+    containerizer/volume_sandbox_path_isolator_tests.cpp)
 endif ()
 
 if (LINUX)
@@ -250,84 +234,109 @@ if (LINUX)
     containerizer/sched_tests.cpp
     containerizer/volume_host_path_isolator_tests.cpp
     containerizer/volume_image_isolator_tests.cpp
-    containerizer/volume_secret_isolator_tests.cpp
-    )
+    containerizer/volume_secret_isolator_tests.cpp)
 endif ()
 
-# INCLUDE DIRECTIVES (generates, e.g., -I/path/to/thing on Linux).
-##################################################################
-include_directories(SYSTEM ${MESOS_3RDPARTY_TESTS_INCLUDE_DIRS})
-include_directories(${MESOS_TESTS_INCLUDE_DIRS})
 
-# LINKING LIBRARIES (might generate, e.g., -L/path/to/thing on Linux).
-######################################################################
-link_directories(${MESOS_TESTS_LIB_DIRS})
+# THE TEST AND HELPER EXECUTABLES.
+##################################
+add_library(mesos-tests-interface INTERFACE)
+target_link_libraries(mesos-tests-interface INTERFACE mesos googletest)
 
-# THE TEST AND HELPER EXECUTABLEs (generates, e.g., stout-tests, etc., on Linux).
-#################################$###############################################
-add_executable(${MESOS_TESTS_TARGET} EXCLUDE_FROM_ALL ${MESOS_TESTS_SRC})
-add_executable(${TEST_HELPER_TARGET} EXCLUDE_FROM_ALL ${TEST_HELPER_SRC})
+if (NOT WIN32)
+  target_link_libraries(
+    mesos-tests-interface INTERFACE
+    load_qos_controller
+    fixed_resource_estimator
+    logrotate_container_logger)
+endif ()
+
+target_compile_definitions(
+  mesos-tests-interface INTERFACE
+  SOURCE_DIR="${CMAKE_SOURCE_DIR}"
+  BUILD_DIR="${CMAKE_BINARY_DIR}"
+  PKGLIBEXECDIR="${PKG_LIBEXEC_INSTALL_DIR}"
+  TESTLIBEXECDIR="${TEST_LIB_EXEC_DIR}"
+  PKGMODULEDIR="${PKG_MODULE_DIR}"
+  SBINDIR="${S_BIN_DIR}")
 
-# ADD LINKER FLAGS (generates, e.g., -lglog on Linux).
-######################################################
-target_link_libraries(${MESOS_TESTS_TARGET} ${MESOS_TESTS_LIBS})
-target_link_libraries(${TEST_HELPER_TARGET} ${MESOS_TESTS_LIBS})
+add_executable(mesos-tests EXCLUDE_FROM_ALL ${MESOS_TESTS_SRC})
+target_link_libraries(mesos-tests PRIVATE mesos-tests-interface)
 
 target_compile_definitions(
-  ${MESOS_TESTS_TARGET} PRIVATE
+  mesos-tests PRIVATE
   $<$<BOOL:${HAS_JAVA}>:MESOS_HAS_JAVA>)
 
-# ADD BINARY DEPENDENCIES (tells CMake what to compile/build first).
-####################################################################
+# Helper to run tests that require a subprocess.
+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_TARGET}
-  ${MESOS_TESTS_DEPENDENCIES}
-  ${TEST_HELPER_TARGET}
-  )
+  mesos-tests
+  test-helper
+  mesos-agent
+  mesos-default-executor
+  mesos-docker-executor
+  mesos-executor
+  mesos-containerizer
+  mesos-tcp-connect
+  mesos-usage)
 
 if (NOT WIN32)
-  # The tests require all the test modules.
+  # The tests require these binaries.
+  # NOTE: These binaries do not yet build on Windows.
+  add_dependencies(
+    mesos-tests
+    mesos-execute
+    mesos-fetcher
+    mesos-log
+    mesos-local
+    mesos-master
+    mesos-io-switchboard
+    mesos-cni-port-mapper
+    mesos-logrotate-logger)
+
+  # The tests require all the test modules. These are not directly linked but
+  # instead loaded at runtime, hence the manual dependency here.
   # NOTE: Modules are not supported on Windows.
   add_dependencies(
-    ${MESOS_TESTS_TARGET}
-    ${TEST_ALLOCATOR}
-    ${TEST_ANONYMOUS}
-    ${TEST_AUTHENTICATION}
-    ${TEST_AUTHORIZER}
-    ${TEST_CONTAINER_LOGGER}
-    ${TEST_EXAMPLEMODULE}
-    ${TEST_HOOK}
-    ${TEST_HTTPAUTHENTICATOR}
-    ${TEST_ISOLATOR}
-    ${TEST_MASTER_CONTENDER}
-    ${TEST_MASTER_DETECTOR}
-    ${TEST_QOS_CONTROLLER}
-    ${TEST_RESOURCE_ESTIMATOR}
-    )
+    mesos-tests
+    testallocator
+    testanonymous
+    testauthentication
+    testauthorizer
+    testcontainer_logger
+    examplemodule
+    testhook
+    testhttpauthenticator
+    testisolator
+    testmastercontender
+    testmasterdetector
+    testqos_controller
+    testresource_estimator)
 
   # The tests require all the example frameworks and executors.
-  # TODO(josephw): The scheduler driver is current not built on Windows.
+  # TODO(josephw): The scheduler driver is currently not built on Windows.
   add_dependencies(
-    ${MESOS_TESTS_TARGET}
-    ${BALLOON_EXECUTOR}
-    ${BALLOON_FRAMEWORK}
-    ${DISK_FULL_FRAMEWORK}
-    ${DOCKER_NO_EXECUTOR_FRAMEWORK}
-    ${DYNAMIC_RESERVATION_FRAMEWORK}
-    ${LOAD_GENERATOR_FRAMEWORK}
-    ${LONG_LIVED_EXECUTOR}
-    ${LONG_LIVED_FRAMEWORK}
-    ${NO_EXECUTOR_FRAMEWORK}
-    ${PERSISTENT_VOLUME_FRAMEWORK}
-    ${TEST_EXECUTOR}
-    ${TEST_FRAMEWORK}
-    ${TEST_HTTP_EXECUTOR}
-    ${TEST_HTTP_FRAMEWORK}
-    )
+    mesos-tests
+    balloon-executor
+    balloon-framework
+    disk-full-framework
+    docker-no-executor-framework
+    dynamic-reservation-framework
+    load-generator-framework
+    long-lived-executor
+    long-lived-framework
+    no-executor-framework
+    persistent-volume-framework
+    test-executor
+    test-framework
+    test-http-executor
+    test-http-framework)
 endif ()
 
-add_dependencies(${TEST_HELPER_TARGET} ${MESOS_TESTS_DEPENDENCIES})
 
 # ADD TEST TARGET (runs when you do, e.g., `make check`).
 #########################################################
-add_test(NAME MesosTests COMMAND ${MESOS_TESTS_TARGET})
+add_test(NAME MesosTests COMMAND mesos-tests)

http://git-wip-us.apache.org/repos/asf/mesos/blob/d10fd9b8/src/tests/cmake/MesosTestsConfigure.cmake
----------------------------------------------------------------------
diff --git a/src/tests/cmake/MesosTestsConfigure.cmake b/src/tests/cmake/MesosTestsConfigure.cmake
deleted file mode 100644
index 8cf2d7f..0000000
--- a/src/tests/cmake/MesosTestsConfigure.cmake
+++ /dev/null
@@ -1,96 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-#
-#     http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-set(
-  MESOS_TESTS_TARGET mesos-tests
-  CACHE STRING "Target we use to refer to tests for the mesos"
-  )
-
-set(
-  TEST_HELPER_TARGET test-helper
-  CACHE STRING "Test helper target to run tests that require a subprocess"
-  )
-
-# COMPILER CONFIGURATION.
-#########################
-# NOTE: On Windows, these paths should be Windows-style, with '\' characters
-# separating path components. Unfortunately, CMake does not escape these
-# slashes in path strings, so when we pass them as preprocessor flags,
-# a string like `C:\src` will look to the standard Windows API like a
-# string with an escaped '\s' character.
-#
-# On the other hand, Windows APIs are happy to take Unix-style paths as
-# arguments. So, to unblock making the agent tests work, we simply use
-# Unix paths here.
-set(CURRENT_CMAKE_SOURCE_DIR ${CMAKE_SOURCE_DIR})
-set(CURRENT_CMAKE_BUILD_DIR ${CMAKE_BINARY_DIR})
-
-add_definitions(-DSOURCE_DIR="${CURRENT_CMAKE_SOURCE_DIR}")
-add_definitions(-DBUILD_DIR="${CURRENT_CMAKE_BUILD_DIR}")
-
-add_definitions(-DPKGLIBEXECDIR="${PKG_LIBEXEC_INSTALL_DIR}")
-add_definitions(-DTESTLIBEXECDIR="${TEST_LIB_EXEC_DIR}")
-add_definitions(-DPKGMODULEDIR="${PKG_MODULE_DIR}")
-add_definitions(-DSBINDIR="${S_BIN_DIR}")
-
-# DEFINE PROCESS LIBRARY DEPENDENCIES. Tells the process library build targets
-# download/configure/build all third-party libraries before attempting to build.
-################################################################################
-set(MESOS_TESTS_DEPENDENCIES
-  ${MESOS_TESTS_DEPENDENCIES}
-  ${MESOS_TARGET}
-  )
-
-# DEFINE THIRD-PARTY INCLUDE DIRECTORIES. Tells compiler toolchain where to get
-# headers for our third party libs (e.g., -I/path/to/glog on Linux)..
-###############################################################################
-set(MESOS_TESTS_INCLUDE_DIRS
-  ${MESOS_TESTS_INCLUDE_DIRS}
-  ${AGENT_INCLUDE_DIRS}
-  )
-
-set(MESOS_3RDPARTY_TESTS_INCLUDE_DIRS
-  ${MESOS_3RDPARTY_TESTS_INCLUDE_DIRS}
-  ${AGENT_3RDPARTY_INCLUDE_DIRS}
-  )
-
-# DEFINE THIRD-PARTY LIB INSTALL DIRECTORIES. Used to tell the compiler
-# toolchain where to find our third party libs (e.g., -L/path/to/glog on
-# Linux).
-########################################################################
-set(MESOS_TESTS_LIB_DIRS
-  ${MESOS_TESTS_LIB_DIRS}
-  )
-
-# DEFINE THIRD-PARTY LIBS. Used to generate flags that the linker uses to
-# include our third-party libs (e.g., -lglog on Linux).
-#########################################################################
-set(MESOS_TESTS_LIBS
-  ${MESOS_TESTS_LIBS}
-  ${MESOS_LIBS_TARGET}
-  ${MESOS_LIBS}
-  process
-  googletest
-  )
-
-if (NOT WIN32)
-  set(MESOS_TESTS_LIBS
-    ${MESOS_TESTS_LIBS}
-    ${QOS_CONTROLLER_TARGET}
-    ${RESOURCE_ESTIMATOR_TARGET}
-    ${LOGROTATE_CONTAINER_LOGGER_TARGET}
-    )
-endif ()

http://git-wip-us.apache.org/repos/asf/mesos/blob/d10fd9b8/src/usage/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/src/usage/CMakeLists.txt b/src/usage/CMakeLists.txt
index fc87b29..e51fe1e 100644
--- a/src/usage/CMakeLists.txt
+++ b/src/usage/CMakeLists.txt
@@ -14,22 +14,7 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-# THE MESOS USAGE SOURCE.
-#########################
-set(USAGE_EXECUTABLE_SRC
-  ${USAGE_EXECUTABLE_SRC}
-  main.cpp
-  )
-
 # THE USAGE EXECUTABLE.
 #######################
-add_executable(${MESOS_USAGE} ${USAGE_EXECUTABLE_SRC})
-
-# ADD LINKER FLAGS (generates, e.g., -lglog on Linux).
-######################################################
-target_link_libraries(${MESOS_USAGE} ${AGENT_LIBS} ${MESOS_LIBS_TARGET})
-
-# ADD BINARY DEPENDENCIES (tells CMake what to compile/build first).
-####################################################################
-add_dependencies(${MESOS_TARGET} ${MESOS_USAGE})
-add_dependencies(${MESOS_USAGE} ${MESOS_LIBS_TARGET})
+add_executable(mesos-usage main.cpp)
+target_link_libraries(mesos-usage PRIVATE mesos)