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/06/12 23:16:32 UTC
[26/27] mesos git commit: CMake: Windows: Updated runtime library
linkage.
CMake: Windows: Updated runtime library linkage.
Instead of hard-coding the static version of the runtime library, this
patch uses the runtime library based on `BUILD_SHARED_LIBS` and
`CMAKE_BUILD_TYPE`, and sets all the appropriate configuration and
language variables.
Review: https://reviews.apache.org/r/59787/
Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/fb54d469
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/fb54d469
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/fb54d469
Branch: refs/heads/master
Commit: fb54d469dcadf762e9c3f8a2fed78ed7b306120a
Parents: 78bb622
Author: Andrew Schwartzmeyer <an...@schwartzmeyer.com>
Authored: Mon Jun 12 14:05:16 2017 -0700
Committer: Joseph Wu <jo...@apache.org>
Committed: Mon Jun 12 15:28:35 2017 -0700
----------------------------------------------------------------------
cmake/CompilationConfigure.cmake | 36 +++++++++++++++++++++++++++--------
1 file changed, 28 insertions(+), 8 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/mesos/blob/fb54d469/cmake/CompilationConfigure.cmake
----------------------------------------------------------------------
diff --git a/cmake/CompilationConfigure.cmake b/cmake/CompilationConfigure.cmake
index 47d0268..3fa2e2f 100644
--- a/cmake/CompilationConfigure.cmake
+++ b/cmake/CompilationConfigure.cmake
@@ -228,18 +228,38 @@ if (WIN32)
# allow for an object file. We use this to avoid those problems.
string(APPEND CMAKE_CXX_FLAGS " /bigobj -DGOOGLE_GLOG_DLL_DECL= /vd2")
- # TODO(andschwa): Define this closer to its usage; anything that includes
- # `curl.h` has to set this so that the declspec is correct.
- if (NOT BUILD_SHARED_LIBS)
+ # Build against the multi-threaded version of the C runtime library (CRT).
+ if (BUILD_SHARED_LIBS)
+ message(WARNING "Building with shared libraries is a work-in-progress.")
+
+ set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)
+
+ # Use dynamic CRT.
+ set(CRT " /MD")
+ else ()
+ # Use static CRT.
+ set(CRT " /MT")
+
+ # TODO(andschwa): Define this closer to its usage; anything that includes
+ # `curl.h` has to set this so that the declspec is correct.
string(APPEND CMAKE_CXX_FLAGS " -DCURL_STATICLIB")
endif ()
- # Enable multi-threaded compilation.
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP")
+ # NOTE: We APPEND ${CRT} rather than REPLACE so it gets picked up by
+ # dependencies.
+ foreach (lang C CXX)
+ # Enable multi-threaded compilation.
+ # NOTE: We do not add CRT here because dependencies will use it incorrectly.
+ string(APPEND CMAKE_${lang}_FLAGS " /MP")
- # Build against the multi-threaded, static version of the runtime library.
- set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /MTd")
- set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /MT")
+ # Debug library for debug configuration.
+ string(APPEND CMAKE_${lang}_FLAGS_DEBUG "${CRT}d")
+
+ # All other configurations.
+ foreach (config RELEASE RELWITHDEBINFO MINSIZEREL)
+ string(APPEND CMAKE_${lang}_FLAGS_${config} ${CRT})
+ endforeach ()
+ endforeach ()
# Convenience flags to simplify Windows support in C++ source; used to
# `#ifdef` out some platform-specific parts of Mesos. We choose to define