View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0016052CMakeCMakepublic2016-04-07 10:362016-06-10 14:21
ReporterStephen Dunn 
Assigned ToBrad King 
PrioritynormalSeveritymajorReproducibilityalways
StatusclosedResolutionfixed 
PlatformWindowsOSAllOS VersionAll
Product VersionCMake 3.5.1 
Target VersionCMake 3.6Fixed in VersionCMake 3.6 
Summary0016052: Extra space on NDEBUG in release builds causes flag to be ignored
DescriptionThis bug was previously reported, but incorrectly marked as resolved here:
http://kwwidgets.org/Bug/view.php?id=1749 [^]

All Release mode configs accidentally append a space after /D in Visual Studio 2015 (14) which causes the flag NDEBUG to be ignored. It should be: /DNDEBUG, not /D NDEBUG which is invalid syntax. Other /D flags are defined correctly.

I check for the presence of this var, and its absence in Release mode causes undefined behavior.
Steps To ReproduceGenerate any project with Release mode builds.
TagsNo tags attached.
Attached Filespng file icon cmake-bug.png [^] (19,737 bytes) 2016-04-07 10:36

 Relationships

  Notes
(0040822)
Brad King (manager)
2016-04-07 11:32

I've removed the space for consistency and because it certainly won't hurt:

 MSVC: Drop space in `/DNDEBUG` flag for consistency
 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=e888af97 [^]

However, it has worked fine with the space for years:

    >type test.c
    #ifdef NDEBUG
    # error ndebug
    #endif

    >cl /D NDEBUG test.c
    Microsoft (R) C/C++ Optimizing Compiler Version 19.00.23506 for x64
    Copyright (C) Microsoft Corporation. All rights reserved.

    test.c
    test.c(2): fatal error C1189: #error: ndebug

Furthermore the CMake-generated .vcxproj file contains the following in ClCompile for the Release configuration:

    <PreprocessorDefinitions>WIN32;_WINDOWS;NDEBUG;CMAKE_INTDIR="Release";%(PreprocessorDefinitions)</PreprocessorDefinitions>
(0040835)
Ben Boeckel (developer)
2016-04-11 10:58

FWIW, I've also seen something similar for VS2013's compiler.

https://github.com/robertmaynard/zeromq4-x/commit/0d5874e6cc52ed783de702e7241e206e58adb1c8 [^]
(0041197)
Kitware Robot (administrator)
2016-06-10 14:21

This issue tracker is no longer used. Further discussion of this issue may take place in the current CMake Issues page linked in the banner at the top of this page.

 Issue History
Date Modified Username Field Change
2016-04-07 10:36 Stephen Dunn New Issue
2016-04-07 10:36 Stephen Dunn File Added: cmake-bug.png
2016-04-07 11:32 Brad King Note Added: 0040822
2016-04-07 11:34 Brad King Assigned To => Brad King
2016-04-07 11:34 Brad King Status new => resolved
2016-04-07 11:34 Brad King Resolution open => fixed
2016-04-07 11:34 Brad King Fixed in Version => CMake 3.6
2016-04-07 11:34 Brad King Target Version => CMake 3.6
2016-04-11 10:58 Ben Boeckel Note Added: 0040835
2016-06-10 14:21 Kitware Robot Note Added: 0041197
2016-06-10 14:21 Kitware Robot Status resolved => closed


Copyright © 2000 - 2018 MantisBT Team