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

Bach, Pascal pascal.bach at siemens.com
Tue Sep 9 05:31:15 EDT 2014


> On 09/08/2014 05:35 AM, Pascal Bach wrote:
> > Even better would be to make the search case insensitive.
> 
> How do we know which flags are sensitive to case?

It has nothing to do with Visual Studio as it doesn't care about the casing.
The problem is in the CMake generator. The tables in (eg. Source/cmVS10LinkFlagTable.h) map from linker flags to XML elements in the resulting .vcxproj file.	

One such example is the entry:
{"SubSystem", "SUBSYSTEM:WINDOWSCE",
   "WindowsCE", "WindowsCE", 0},

This maps a flag 
/SUBSYSTEM:WINDOWSCE 
to
<Subsystem>
WindowsCE
</Subsystem>

As you can see the entries in the table are in upper case. And the mapping does only work if the flags are uppercase to.
Maybe a better solution would be to do this matching in a case in sensitive way, this way it would work in any case even with user passed flags in lower case.

> 
> > -  set(CMAKE_CREATE_WIN32_EXE "/entry:WinMainCRTStartup")
> > -  set(CMAKE_CREATE_CONSOLE_EXE "/entry:mainACRTStartup")
> > -  set(_PLATFORM_LINK_FLAGS " /subsystem:windowsce")
> > +  set(CMAKE_CREATE_WIN32_EXE "/SUBSYSTEM:WINDOWSCE
> /ENTRY:WinMainCRTStartup")
> > +  set(CMAKE_CREATE_CONSOLE_EXE "/SUBSYSTEM:WINDOWSCE
> /ENTRY:mainACRTStartup")
> > +  set(_PLATFORM_LINK_FLAGS "")
> 
> That appears to un-do this recent fix:
> 
>  MSVC: Fix linking of DLLs on WinCE (#15013)
>  http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=7e1283e4
>  http://www.cmake.org/Bug/view.php?id=15013
> 
> that introduced _PLATFORM_LINK_FLAGS in the first place.

Rith I think I had a too simplistic view here. But even the old fix doesn't seem to work with VS. I think the /ENTRY point also needs to be set for the DLLs, I will try if I can find out how to set this.

Pascal

PS: Forgot to add the mailinglist.



More information about the cmake-developers mailing list