zookeeper-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From h...@apache.org
Subject zookeeper git commit: ZOOKEEPER-2874: Windows Debug builds don't link with `/MTd`
Date Fri, 18 Aug 2017 04:21:13 GMT
Repository: zookeeper
Updated Branches:
  refs/heads/branch-3.4 1f811a628 -> b903a07c4


ZOOKEEPER-2874: Windows Debug builds don't link with `/MTd`

When building in Debug configuration, this logic ensures that `/MTd` is
used instead of just `/MT`, which on Windows means to link to the
multi-threaded (debug) version of the standard library.

When the user does not add `/MT` as a compile option manually, CMake
would otherwise link to the correct one. Because we are overriding it
for threaded compilations, we also must ensure that Debug configurations
are specially handled.

Furthermore, this must be done using a generator expression over
configuration time logic because the Visual Studio CMake generators are
"multi-configuration generators", that is, the configuration is chosen
at build time instead of compile time. The generator expression handles
this scenario, but checking `CMAKE_BUILD_TYPE` would not.

Author: Andrew Schwartzmeyer <andrew@schwartzmeyer.com>

Reviewers: Michael Han <hanm@apache.org>

Closes #335 from andschwa/ZOOKEEPER-2874

(cherry picked from commit ab182d4561f1c6725af0e89e0b76d92186732195)
Signed-off-by: Michael Han <hanm@apache.org>


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

Branch: refs/heads/branch-3.4
Commit: b903a07c4944cb0a90045e686b7c3f153aee6153
Parents: 1f811a6
Author: Andrew Schwartzmeyer <andrew@schwartzmeyer.com>
Authored: Thu Aug 17 21:20:49 2017 -0700
Committer: Michael Han <hanm@apache.org>
Committed: Thu Aug 17 21:21:09 2017 -0700

----------------------------------------------------------------------
 src/c/CMakeLists.txt | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/zookeeper/blob/b903a07c/src/c/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/src/c/CMakeLists.txt b/src/c/CMakeLists.txt
index a69cd77..6219fc4 100644
--- a/src/c/CMakeLists.txt
+++ b/src/c/CMakeLists.txt
@@ -40,7 +40,9 @@ option(WANT_SYNCAPI "Enables Sync API support" ON)
 if(WANT_SYNCAPI)
   add_definitions(-DTHREADED)
   if(WIN32)
-    add_compile_options(/MT)
+    # Note that the generator expression ensures that `/MTd` is used when Debug
+    # configurations are built.
+    add_compile_options(/MT$<$<CONFIG:Debug>:d>)
   endif()
 endif()
 


Mime
View raw message