Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 5F99D200CE7 for ; Fri, 18 Aug 2017 06:21:15 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 5E0AB16C3D9; Fri, 18 Aug 2017 04:21:15 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id A4B8916C3D8 for ; Fri, 18 Aug 2017 06:21:14 +0200 (CEST) Received: (qmail 80528 invoked by uid 500); 18 Aug 2017 04:21:13 -0000 Mailing-List: contact commits-help@zookeeper.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@zookeeper.apache.org Delivered-To: mailing list commits@zookeeper.apache.org Received: (qmail 80517 invoked by uid 99); 18 Aug 2017 04:21:13 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 18 Aug 2017 04:21:13 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 7E70DDFBFF; Fri, 18 Aug 2017 04:21:13 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: hanm@apache.org To: commits@zookeeper.apache.org Message-Id: <56e1fc053dd24810b433ae7f265a3e55@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: zookeeper git commit: ZOOKEEPER-2874: Windows Debug builds don't link with `/MTd` Date: Fri, 18 Aug 2017 04:21:13 +0000 (UTC) archived-at: Fri, 18 Aug 2017 04:21:15 -0000 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 Reviewers: Michael Han Closes #335 from andschwa/ZOOKEEPER-2874 (cherry picked from commit ab182d4561f1c6725af0e89e0b76d92186732195) Signed-off-by: Michael Han 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 Authored: Thu Aug 17 21:20:49 2017 -0700 Committer: Michael Han 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$<$:d>) endif() endif()