[cmake-developers] [CMake 0015866]: CMake should work around D9025 when using NMake Makefiles generator

Mantis Bug Tracker mantis at public.kitware.com
Sat Nov 28 15:15:41 EST 2015


The following issue has been SUBMITTED. 
====================================================================== 
https://public.kitware.com/Bug/view.php?id=15866 
====================================================================== 
Reported By:                temp4746
Assigned To:                
====================================================================== 
Project:                    CMake
Issue ID:                   15866
Category:                   CMake
Reproducibility:            always
Severity:                   feature
Priority:                   normal
Status:                     new
====================================================================== 
Date Submitted:             2015-11-28 15:15 EST
Last Modified:              2015-11-28 15:15 EST
====================================================================== 
Summary:                    CMake should work around D9025 when using NMake
Makefiles generator
Description: 
When using the Visual Studio IDE generators CMake maps compiler/linker flags
supported by the IDE to the vcxproj properties. This as a side effect prevents
passing multiple conflicting flags for most commonly used compiler/linker flags,
such as "/W[0-4]".

This is not done for NMake Makefiles, this means when you use them and
additionally use something like:
target_compile_options(target PRIVATE /W0)

You will receive D9025 warnings.

This warning is because the cl compiler is annoying and unlike gcc/clang will
emit a warning (D9025) when there are conflicting flags and still use the later
flag in the command line like expected.

I think CMake should work around this by removing conflicting flags leaving only
the latest one on the command line, similar to what you get when you use the IDE
project files. At least for the commonly used flags or ones that exist in the
IDE project files as specific properties.

Steps to Reproduce: 
cmake_minimum_required(VERSION 3.4)
project(flags)
add_library(a STATIC a.cpp)
target_compile_options(a PRIVATE /W4)

Try this both with an MSVC IDE and NMake Makefiles.
====================================================================== 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2015-11-28 15:15 temp4746       New Issue                                    
======================================================================



More information about the cmake-developers mailing list