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:03 GMT
Repository: zookeeper
Updated Branches:
  refs/heads/branch-3.5 1bcf57dc7 -> 8f68c0483

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/8f68c048
Tree: http://git-wip-us.apache.org/repos/asf/zookeeper/tree/8f68c048
Diff: http://git-wip-us.apache.org/repos/asf/zookeeper/diff/8f68c048

Branch: refs/heads/branch-3.5
Commit: 8f68c04838c3d034bcef7e937a3c23f3cfef8065
Parents: 1bcf57d
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:20:59 2017 -0700

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

diff --git a/src/c/CMakeLists.txt b/src/c/CMakeLists.txt
index ef95a76..817fc97 100644
--- a/src/c/CMakeLists.txt
+++ b/src/c/CMakeLists.txt
@@ -40,7 +40,9 @@ option(WANT_SYNCAPI "Enables Sync API support" ON)
-    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>)

View raw message