[cmake-developers] [PATCH 3/3] VS: Pass MSVC compiler flags in upper case

Brad King brad.king at kitware.com
Tue Sep 9 11:11:45 EDT 2014


On 09/09/2014 11:02 AM, Bach, Pascal wrote:
> I don't understand the purpose of the flag tables [1].
> Aren't they there to map from command line to XML files?

Yes, but they were created originally to support flags specified
by users in CMAKE_C_FLAGS and a few other places.

> At first I tought the way things work was:
> Windows-MSVC.cmake and Co construct a commandline with the required flags.
> The VS generator parses this command line and uses the cmVS7FlagTable to
> translate the known flags to XML elements.
> (Unknown arguments get passed as additional arguments).

This is done for a subset of the sources of flags, specifically
those settable by users and project code.  We can't use a complete
command line like that in CMAKE_${lang}_CREATE_SHARED_LIBRARY
because that will contain a lot of pieces besides the flags.
Also multi-configuration is an issue as you point out.

You would need to create new variables in Windows-MSVC to hold
the flags to be scanned by the VS generators.  Then re-use the
flags in constructing the other rule variables with command-lines
used by the Makefile and Ninja generators.

-Brad




More information about the cmake-developers mailing list