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:20:53 GMT
Repository: zookeeper
Updated Branches:
  refs/heads/master 29d25c4d7 -> ab182d456


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


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

Branch: refs/heads/master
Commit: ab182d4561f1c6725af0e89e0b76d92186732195
Parents: 29d25c4
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:49 2017 -0700

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


http://git-wip-us.apache.org/repos/asf/zookeeper/blob/ab182d45/src/c/CMakeLists.txt
----------------------------------------------------------------------
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)
 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