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/10/02 21:38:17 UTC

[1/4] mesos git commit: CMake: Removed `MESOS_CPPFLAGS` variable.

Repository: mesos
Updated Branches:
  refs/heads/master 5d4328b92 -> bd5e874c2


CMake: Removed `MESOS_CPPFLAGS` variable.

This was a magic variable that was used to add compiler definitions
globally. Instead, global definitions are now added explicitly with
`add_definitions`, and others with `target_compile_definitions`.

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


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

Branch: refs/heads/master
Commit: bd5e874c22f0d16fc5494213d319065cf9107d0f
Parents: 3f15ded
Author: Andrew Schwartzmeyer <an...@schwartzmeyer.com>
Authored: Mon Oct 2 14:33:52 2017 -0700
Committer: Joseph Wu <jo...@apache.org>
Committed: Mon Oct 2 14:36:56 2017 -0700

----------------------------------------------------------------------
 cmake/CompilationConfigure.cmake | 20 ++++++--------------
 src/CMakeLists.txt               | 11 +++++++++++
 2 files changed, 17 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/bd5e874c/cmake/CompilationConfigure.cmake
----------------------------------------------------------------------
diff --git a/cmake/CompilationConfigure.cmake b/cmake/CompilationConfigure.cmake
index e414406..a94cfa1 100644
--- a/cmake/CompilationConfigure.cmake
+++ b/cmake/CompilationConfigure.cmake
@@ -299,13 +299,13 @@ if (WIN32)
   # to give the build system fine-grained control over what code is #ifdef'd
   # out in the future.  Using only flags defined by our build system to control
   # this logic is the clearest and most stable way of accomplishing this.
-  list(APPEND MESOS_CPPFLAGS -D__WINDOWS__)
+  add_definitions(-D__WINDOWS__)
 
   # Defines to disable warnings generated by Visual Studio when using
   # deprecated functions in CRT and the use of insecure functions in CRT.
   # TODO(dpravat): Once the entire codebase is changed to use secure CRT
   # functions, these defines should be removed.
-  list(APPEND MESOS_CPPFLAGS
+  add_definitions(
     -D_SCL_SECURE_NO_WARNINGS
     -D_CRT_SECURE_NO_WARNINGS
     -D_CRT_NONSTDC_NO_WARNINGS)
@@ -331,14 +331,16 @@ endif ()
 # and other general exploits that rely on deterministic offsets.
 set(CMAKE_POSITION_INDEPENDENT_CODE TRUE)
 
-list(APPEND MESOS_CPPFLAGS
+# TODO(andschwa): Make these non-global.
+add_definitions(
   -DPKGLIBEXECDIR="${PKG_LIBEXEC_INSTALL_DIR}"
   -DLIBDIR="${LIB_INSTALL_DIR}"
   -DVERSION="${PACKAGE_VERSION}"
   -DPKGDATADIR="${DATA_INSTALL_PREFIX}")
 
 if (ENABLE_SSL)
-  list(APPEND MESOS_CPPFLAGS -DUSE_SSL_SOCKET=1)
+  # TODO(andschwa): Make this non-global.
+  add_definitions(-DUSE_SSL_SOCKET=1)
 endif ()
 
 # Calculate some build information.
@@ -382,13 +384,3 @@ configure_file(
   "${CMAKE_SOURCE_DIR}/src/common/build_config.hpp.in"
   "${CMAKE_BINARY_DIR}/src/common/build_config.hpp"
   @ONLY)
-
-# NOTE: The quotes in these definitions are necessary. Without them, the
-# preprocessor will interpret the symbols as (e.g.) int literals and uquoted
-# identifiers, rather than the string values our code expects.
-list(APPEND MESOS_CPPFLAGS
-  -DUSE_CMAKE_BUILD_CONFIG
-  -DBUILD_JAVA_JVM_LIBRARY="${JAVA_JVM_LIBRARY}")
-
-# TODO(hausdorff): (MESOS-5455) `BUILD_FLAGS` is currently a placeholder value.
-add_definitions(${MESOS_CPPFLAGS} -DBUILD_FLAGS="")

http://git-wip-us.apache.org/repos/asf/mesos/blob/bd5e874c/src/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index f8d56ae..5677933 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -594,6 +594,17 @@ 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_include_directories(
   mesos PUBLIC
   ${MESOS_PUBLIC_INCLUDE_DIR}


[4/4] mesos git commit: Windows: Fixed ordering of system headers.

Posted by jo...@apache.org.
Windows: Fixed ordering of system headers.

This patch consolidates the inclusion of the ordering-dependent Windows
system headers `WinSock2.h`, `WS2tcpip.h`, `Windows.h`, etc.

For historical reasons, `Windows.h` will include `winsock.h`, the header
for the Windows Sockets 1.1 library, which was last supported in Windows
2000.  We use the Windows Sockets 2 library, which requires the
`WinSock2.h` header, and this header must be included before
`Windows.h`, otherwise symbol redefinition errors will occur.
The `WS2tcpip.h` header includes the extensions to Windows Sockets 2,
and any header which may include `Windows.h` must be included carefully.

It is simplest to consolidate the inclusion of these problematic system
headers into `stout/windows.hpp`, and elsewhere include that with a
comment as to which header specifically the file is requiring. Doing so
will prevent incorrect ordering from being introduced.

Note that the erroneous inclusion of `winsock.h` was removed.

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


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

Branch: refs/heads/master
Commit: 93f670e923399511618eb816144da6a02ca3b8c4
Parents: 5d4328b
Author: Andrew Schwartzmeyer <an...@schwartzmeyer.com>
Authored: Mon Oct 2 12:09:02 2017 -0700
Committer: Joseph Wu <jo...@apache.org>
Committed: Mon Oct 2 14:36:56 2017 -0700

----------------------------------------------------------------------
 3rdparty/stout/include/stout/ip.hpp             |  6 ++---
 3rdparty/stout/include/stout/os/windows/dup.hpp |  4 +--
 3rdparty/stout/include/stout/os/windows/fd.hpp  |  4 +--
 .../stout/include/stout/os/windows/sendfile.hpp |  2 +-
 .../stout/include/stout/os/windows/socket.hpp   |  5 ++--
 3rdparty/stout/include/stout/windows.hpp        | 27 +++++++++++++-------
 3rdparty/stout/include/stout/windows/ip.hpp     |  2 +-
 3rdparty/stout/include/stout/windows/mac.hpp    |  2 +-
 3rdparty/stout/include/stout/windows/net.hpp    |  3 ++-
 3rdparty/stout/include/stout/windows/os.hpp     | 15 ++++++-----
 10 files changed, 39 insertions(+), 31 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/93f670e9/3rdparty/stout/include/stout/ip.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/stout/include/stout/ip.hpp b/3rdparty/stout/include/stout/ip.hpp
index a722fa4..b4abcb9 100644
--- a/3rdparty/stout/include/stout/ip.hpp
+++ b/3rdparty/stout/include/stout/ip.hpp
@@ -34,9 +34,7 @@
 // Note: Header grouping and ordering is considered before
 // inclusion/exclusion by platform.
 // For 'inet_pton', 'inet_ntop'.
-#ifdef __WINDOWS__
-#include <Ws2tcpip.h>
-#else
+#ifndef __WINDOWS__
 #include <netinet/in.h>
 #include <sys/socket.h>
 #endif // __WINDOWS__
@@ -66,7 +64,7 @@
 #include <stout/unreachable.hpp>
 
 #ifdef __WINDOWS__
-#include <stout/windows.hpp>
+#include <stout/windows.hpp> // For `WS2tcpip.h`.
 #endif // __WINDOWS__
 
 namespace net {

http://git-wip-us.apache.org/repos/asf/mesos/blob/93f670e9/3rdparty/stout/include/stout/os/windows/dup.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/stout/include/stout/os/windows/dup.hpp b/3rdparty/stout/include/stout/os/windows/dup.hpp
index 1c9dda0..b37aaa6 100644
--- a/3rdparty/stout/include/stout/os/windows/dup.hpp
+++ b/3rdparty/stout/include/stout/os/windows/dup.hpp
@@ -13,12 +13,10 @@
 #ifndef __STOUT_OS_WINDOWS_DUP_HPP__
 #define __STOUT_OS_WINDOWS_DUP_HPP__
 
-#include <io.h>
-#include <Winsock2.h>
-
 #include <stout/error.hpp>
 #include <stout/try.hpp>
 #include <stout/unreachable.hpp>
+#include <stout/windows.hpp> // For `WinSock2.h`.
 
 #include <stout/os/windows/fd.hpp>
 

http://git-wip-us.apache.org/repos/asf/mesos/blob/93f670e9/3rdparty/stout/include/stout/os/windows/fd.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/stout/include/stout/os/windows/fd.hpp b/3rdparty/stout/include/stout/os/windows/fd.hpp
index ae2db27..8f31f46 100644
--- a/3rdparty/stout/include/stout/os/windows/fd.hpp
+++ b/3rdparty/stout/include/stout/os/windows/fd.hpp
@@ -13,9 +13,6 @@
 #ifndef __STOUT_OS_WINDOWS_FD_HPP__
 #define __STOUT_OS_WINDOWS_FD_HPP__
 
-#include <windows.h>
-#include <WinSock2.h>
-
 #include <array>
 #include <memory>
 #include <ostream>
@@ -24,6 +21,7 @@
 #include <stout/nothing.hpp>
 #include <stout/try.hpp>
 #include <stout/unreachable.hpp>
+#include <stout/windows.hpp> // For `WinSock2.h`.
 
 namespace os {
 

http://git-wip-us.apache.org/repos/asf/mesos/blob/93f670e9/3rdparty/stout/include/stout/os/windows/sendfile.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/stout/include/stout/os/windows/sendfile.hpp b/3rdparty/stout/include/stout/os/windows/sendfile.hpp
index d50c89e..fff5872 100644
--- a/3rdparty/stout/include/stout/os/windows/sendfile.hpp
+++ b/3rdparty/stout/include/stout/os/windows/sendfile.hpp
@@ -17,7 +17,7 @@
 
 #include <stout/error.hpp>
 #include <stout/try.hpp>
-#include <stout/windows.hpp>
+#include <stout/windows.hpp> // For `winioctl.h`.
 
 #include <stout/os/windows/fd.hpp>
 

http://git-wip-us.apache.org/repos/asf/mesos/blob/93f670e9/3rdparty/stout/include/stout/os/windows/socket.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/stout/include/stout/os/windows/socket.hpp b/3rdparty/stout/include/stout/os/windows/socket.hpp
index 18d2ecf..020c5e2 100644
--- a/3rdparty/stout/include/stout/os/windows/socket.hpp
+++ b/3rdparty/stout/include/stout/os/windows/socket.hpp
@@ -13,13 +13,14 @@
 #ifndef __STOUT_OS_WINDOWS_SOCKET_HPP__
 #define __STOUT_OS_WINDOWS_SOCKET_HPP__
 
-#include <winsock.h>
-
 #include <glog/logging.h>
 
 #include <stout/abort.hpp>
+#include <stout/windows.hpp> // For `WinSock2.h`.
+
 #include <stout/os/windows/fd.hpp>
 
+
 namespace net {
 
 // Initialize Windows socket stack.

http://git-wip-us.apache.org/repos/asf/mesos/blob/93f670e9/3rdparty/stout/include/stout/windows.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/stout/include/stout/windows.hpp b/3rdparty/stout/include/stout/windows.hpp
index 1d865f8..fd7ffea 100644
--- a/3rdparty/stout/include/stout/windows.hpp
+++ b/3rdparty/stout/include/stout/windows.hpp
@@ -13,6 +13,23 @@
 #ifndef __STOUT_WINDOWS_HPP__
 #define __STOUT_WINDOWS_HPP__
 
+// We include `WinSock2.h` before `Windows.h` explicitly to avoid symbol
+// re-definitions. This is a documented pattern, because `Windows.h` will
+// otherwise include `winsock.h` for "historical reasons". Note that
+// `winsock.h` is for Windows Sockets 1.1, last used in Windows 2000.
+//
+// NOTE: The capitalization of these headers is based on the files
+// included in the SDK, rather than MSDN documentation.
+//
+// https://msdn.microsoft.com/en-us/library/windows/desktop/ms738562(v=vs.85).aspx
+// NOLINT(whitespace/line_length)
+#include <WinSock2.h> // For Windows Sockets 2.
+#include <WS2tcpip.h> // For `getaddrinfo` etc.
+#include <iphlpapi.h> // For `GetAdaptersInfo`.
+#include <MSWSock.h>  // For `TransmitFile`.
+#include <winioctl.h> // For `DeviceIoControl`
+#include <Windows.h>  // For everything else.
+
 #include <direct.h>   // For `_mkdir`.
 #include <errno.h>    // For `_set_errno`.
 #include <fcntl.h>    // For file access flags like `_O_CREAT`.
@@ -22,15 +39,7 @@
 
 #include <sys/stat.h> // For permissions flags.
 
-#include <BaseTsd.h>  // For `SSIZE_T`.
-// We include `Winsock2.h` before `Windows.h` explicitly to avoid symbold
-// re-definitions. This is a known pattern in the windows community.
-#include <WS2tcpip.h>
-#include <Winsock2.h>
-#include <iphlpapi.h>
-#include <mswsock.h>
-#include <winioctl.h>
-#include <Windows.h>
+#include <basetsd.h>  // For `SSIZE_T`.
 
 #include <memory>
 

http://git-wip-us.apache.org/repos/asf/mesos/blob/93f670e9/3rdparty/stout/include/stout/windows/ip.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/stout/include/stout/windows/ip.hpp b/3rdparty/stout/include/stout/windows/ip.hpp
index d7738f2..16c075d 100644
--- a/3rdparty/stout/include/stout/windows/ip.hpp
+++ b/3rdparty/stout/include/stout/windows/ip.hpp
@@ -20,7 +20,7 @@
 #include <stout/none.hpp>
 #include <stout/result.hpp>
 #include <stout/try.hpp>
-#include <stout/windows.hpp>
+#include <stout/windows.hpp> // For `iphlpapi.h`.
 
 
 namespace net {

http://git-wip-us.apache.org/repos/asf/mesos/blob/93f670e9/3rdparty/stout/include/stout/windows/mac.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/stout/include/stout/windows/mac.hpp b/3rdparty/stout/include/stout/windows/mac.hpp
index 3ebf4e1..44f2815 100644
--- a/3rdparty/stout/include/stout/windows/mac.hpp
+++ b/3rdparty/stout/include/stout/windows/mac.hpp
@@ -20,7 +20,7 @@
 #include <stout/none.hpp>
 #include <stout/result.hpp>
 #include <stout/stringify.hpp>
-#include <stout/windows.hpp>
+#include <stout/windows.hpp> // For `iphlpapi.h`.
 
 
 // Network utilities.

http://git-wip-us.apache.org/repos/asf/mesos/blob/93f670e9/3rdparty/stout/include/stout/windows/net.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/stout/include/stout/windows/net.hpp b/3rdparty/stout/include/stout/windows/net.hpp
index 364509f..d70f967 100644
--- a/3rdparty/stout/include/stout/windows/net.hpp
+++ b/3rdparty/stout/include/stout/windows/net.hpp
@@ -22,7 +22,8 @@
 #include <stout/nothing.hpp>
 #include <stout/stringify.hpp>
 #include <stout/try.hpp>
-#include <stout/windows.hpp>
+#include <stout/windows.hpp> // For `iphlpapi.h`.
+
 #include <stout/windows/os.hpp>
 
 

http://git-wip-us.apache.org/repos/asf/mesos/blob/93f670e9/3rdparty/stout/include/stout/windows/os.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/stout/include/stout/windows/os.hpp b/3rdparty/stout/include/stout/windows/os.hpp
index a70a61c..09ddec6 100644
--- a/3rdparty/stout/include/stout/windows/os.hpp
+++ b/3rdparty/stout/include/stout/windows/os.hpp
@@ -13,12 +13,6 @@
 #ifndef __STOUT_WINDOWS_OS_HPP__
 #define __STOUT_WINDOWS_OS_HPP__
 
-#include <direct.h>
-#include <io.h>
-#include <Psapi.h>
-#include <TlHelp32.h>
-#include <Userenv.h>
-
 #include <sys/utime.h>
 
 #include <list>
@@ -46,6 +40,15 @@
 #include <stout/os/raw/environment.hpp>
 #include <stout/os/windows/fd.hpp>
 
+// NOTE: These system headers must be included after `stout/windows.hpp`
+// as they may include `Windows.h`. See comments in `stout/windows.hpp`
+// for why this ordering is important.
+#include <direct.h>
+#include <io.h>
+#include <Psapi.h>
+#include <TlHelp32.h>
+#include <Userenv.h>
+
 namespace os {
 namespace internal {
 


[3/4] mesos git commit: CMake: Used `TRUE|FALSE` instead of `ON|OFF` consistently.

Posted by jo...@apache.org.
CMake: Used `TRUE|FALSE` instead of `ON|OFF` consistently.

While these are equivalent values to CMake, we should be consistent.
Also made uses of `option` consistent, and moved `ENABLE_JAVA` to the
3rdparty section.

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


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

Branch: refs/heads/master
Commit: 3f15dedb221a6882fd01b172f584527c496d4e1e
Parents: 0ee21fb
Author: Andrew Schwartzmeyer <an...@schwartzmeyer.com>
Authored: Mon Oct 2 14:12:30 2017 -0700
Committer: Joseph Wu <jo...@apache.org>
Committed: Mon Oct 2 14:36:56 2017 -0700

----------------------------------------------------------------------
 cmake/CompilationConfigure.cmake | 76 +++++++++++++++++++----------------
 1 file changed, 42 insertions(+), 34 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/3f15dedb/cmake/CompilationConfigure.cmake
----------------------------------------------------------------------
diff --git a/cmake/CompilationConfigure.cmake b/cmake/CompilationConfigure.cmake
index 9707e88..e414406 100644
--- a/cmake/CompilationConfigure.cmake
+++ b/cmake/CompilationConfigure.cmake
@@ -16,43 +16,24 @@
 
 # GENERAL OPTIONS.
 ##################
-option(VERBOSE "Enable verbose CMake statements and compilation output" ON)
+option(VERBOSE
+  "Enable verbose CMake statements and compilation output."
+  TRUE)
 set(CMAKE_VERBOSE_MAKEFILE ${VERBOSE})
 
 if (NOT WIN32)
-  set(DEFAULT_BUILD_SHARED_LIBS ON)
+  set(DEFAULT_BUILD_SHARED_LIBS TRUE)
 else ()
-  set(DEFAULT_BUILD_SHARED_LIBS OFF)
+  set(DEFAULT_BUILD_SHARED_LIBS FALSE)
 endif ()
 
-option(BUILD_SHARED_LIBS "Build shared libraries." ${DEFAULT_BUILD_SHARED_LIBS})
-
-option(ENABLE_JAVA "Build Java components. Warning: this is SLOW." OFF)
-if (ENABLE_JAVA)
-  include(FindJava)
-  find_package(Java COMPONENTS Development)
-
-  if (NOT JAVA_FOUND)
-    message(FATAL_ERROR "Java was not found!")
-  endif ()
-
-  include(FindJNI)
-  if (NOT JNI_FOUND)
-    message(FATAL_ERROR "JNI Java libraries were not found!")
-  endif ()
-
-  find_program(MVN mvn)
-  if (NOT MVN)
-    message(FATAL_ERROR "Maven was not found!")
-  endif ()
-
-  if (Java_FOUND AND JNI_FOUND AND MVN)
-    set(HAS_JAVA TRUE)
-  endif ()
-endif ()
+option(BUILD_SHARED_LIBS
+  "Build shared libraries."
+  ${DEFAULT_BUILD_SHARED_LIBS})
 
 option(ENABLE_PRECOMPILED_HEADERS
-  "Enable auto-generated precompiled headers using cotire" ${WIN32})
+  "Enable auto-generated precompiled headers using cotire"
+  ${WIN32})
 
 if (NOT WIN32 AND ENABLE_PRECOMPILED_HEADERS)
   message(
@@ -88,24 +69,51 @@ endif ()
 ###################
 option(
   REBUNDLED
-  "Use dependencies from the 3rdparty folder (instead of internet)"
+  "Use dependencies from the 3rdparty folder (instead of internet)."
   TRUE)
 
 option(
   ENABLE_LIBEVENT
-  "Use libevent instead of libev as the core event loop implementation"
+  "Use libevent instead of libev as the core event loop implementation."
   FALSE)
 
 option(
   ENABLE_SSL
-  "Build libprocess with SSL support"
+  "Build libprocess with SSL support."
   FALSE)
 
 option(
   ENABLE_LOCK_FREE_RUN_QUEUE
-  "Build libprocess with lock free run queue"
+  "Build libprocess with lock free run queue."
   FALSE)
 
+option(ENABLE_JAVA
+  "Build Java components. Warning: this is SLOW."
+  FALSE)
+
+if (ENABLE_JAVA)
+  include(FindJava)
+  find_package(Java COMPONENTS Development)
+
+  if (NOT JAVA_FOUND)
+    message(FATAL_ERROR "Java was not found!")
+  endif ()
+
+  include(FindJNI)
+  if (NOT JNI_FOUND)
+    message(FATAL_ERROR "JNI Java libraries were not found!")
+  endif ()
+
+  find_program(MVN mvn)
+  if (NOT MVN)
+    message(FATAL_ERROR "Maven was not found!")
+  endif ()
+
+  if (Java_FOUND AND JNI_FOUND AND MVN)
+    set(HAS_JAVA TRUE)
+  endif ()
+endif ()
+
 # If 'REBUNDLED' is set to FALSE, this will cause Mesos to build against the
 # specified dependency repository. This is especially useful for Windows
 # builds, because building on MSVC 1900 requires newer versions of some
@@ -260,7 +268,7 @@ if (WIN32)
   if (BUILD_SHARED_LIBS)
     message(WARNING "Building with shared libraries is a work-in-progress.")
 
-    set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)
+    set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS TRUE)
 
     # Use dynamic CRT.
     set(CRT " /MD")


[2/4] mesos git commit: CMake: Cleaned up `External.cmake`.

Posted by jo...@apache.org.
CMake: Cleaned up `External.cmake`.

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

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


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

Branch: refs/heads/master
Commit: 0ee21fb49ec5b443ed3a29c66846923e386f3c46
Parents: 93f670e
Author: Andrew Schwartzmeyer <an...@schwartzmeyer.com>
Authored: Mon Oct 2 13:57:20 2017 -0700
Committer: Joseph Wu <jo...@apache.org>
Committed: Mon Oct 2 14:36:56 2017 -0700

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


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