[ 
https://issues.apache.org/jira/browse/ZOOKEEPER-2874?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16124180#comment-16124180
 ] 

ASF GitHub Bot commented on ZOOKEEPER-2874:
-------------------------------------------

GitHub user andschwa opened a pull request:

    https://github.com/apache/zookeeper/pull/335

    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_CONFIG` would not.

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/andschwa/zookeeper ZOOKEEPER-2874

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/zookeeper/pull/335.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #335
    
----
commit 554e20e1f63c02e058f05010868c3f6b5a4b1f2c
Author: Andrew Schwartzmeyer <and...@schwartzmeyer.com>
Date:   2017-08-11T22:03:28Z

    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_CONFIG` would not.

----


> Windows Debug builds don't link with `/MTd`
> -------------------------------------------
>
>                 Key: ZOOKEEPER-2874
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-2874
>             Project: ZooKeeper
>          Issue Type: Bug
>         Environment: Windows 10 using CMake
>            Reporter: Andrew Schwartzmeyer
>            Assignee: Andrew Schwartzmeyer
>
> While not apparent when building ZooKeeper stand-alone, further testing when 
> linking with Mesos revealed it was ZooKeeper that was causing the warning:
> {noformat}
> LIBCMTD.lib(initializers.obj) : warning LNK4098: defaultlib 'libcmt.lib' 
> conflicts with use of other libs; use /NODEFAULTLIB:library 
> [C:\Users\andschwa\src\mesos\build\src\slave\mesos-agent.vcxproj]
> {noformat}
> As Mesos is linking with {{/MTd}} in Debug configuration (which is the most 
> common practice).
> Once I found the source of the warning, the fix is trivial and I am posting a 
> patch.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to