MantisBT - CMake
View Issue Details
0015100CMakeCCMakepublic2014-08-21 16:062015-03-02 08:57
Timur 
Brad King 
hightweakalways
closedfixed 
CMake 3.0.1 
CMake 3.1CMake 3.1 
0015100: /ZW- compiler flag to disable CompileAsWinRT property in Visual Studio project
Related to Issue 0012930

Visual Studio 12 WinRT application project requires CompileAsWinRT enabled
But when project also contains .c files this option must be turned off on them.
C files cannot be compiled with CompileAsWinRT setting.

CompileAsWinRT can be enabled with compile flag /ZW but cannot be disabled with /ZW-

Can be easily fixed by addition additional compile flag definition for /ZW- before /ZW:

  {"CompileAsWinRT", "ZW-", "", "false", 0},
before existing: {"CompileAsWinRT", "ZW", "", "true", 0},

into the cmVS12CLFlagTable[] and cmVS11CLFlagTable
---
 Source/cmVS11CLFlagTable.h | 1 +
 Source/cmVS12CLFlagTable.h | 1 +
 2 files changed, 2 insertions(+)

diff --git a/Source/cmVS11CLFlagTable.h b/Source/cmVS11CLFlagTable.h
index a61ab16..f591309 100644
--- a/Source/cmVS11CLFlagTable.h
+++ b/Source/cmVS11CLFlagTable.h
@@ -163,6 +163,7 @@ static cmVS7FlagTable cmVS11CLFlagTable[] =
 
 
   //Bool Properties
+ {"CompileAsWinRT", "ZW-", "", "false", 0},
   {"CompileAsWinRT", "ZW", "", "true", 0},
   {"WinRTNoStdLib", "ZW:nostdlib", "", "true", 0},
   {"SuppressStartupBanner", "nologo-", "", "false", 0},
diff --git a/Source/cmVS12CLFlagTable.h b/Source/cmVS12CLFlagTable.h
index 0a7916f..348f75b 100644
--- a/Source/cmVS12CLFlagTable.h
+++ b/Source/cmVS12CLFlagTable.h
@@ -172,6 +172,7 @@ static cmVS7FlagTable cmVS12CLFlagTable[] =
 
 
   //Bool Properties
+ {"CompileAsWinRT", "ZW-", "", "false", 0},
   {"CompileAsWinRT", "ZW", "", "true", 0},
   {"WinRTNoStdLib", "ZW:nostdlib", "", "true", 0},
   {"SuppressStartupBanner", "nologo", "", "true", 0},
--
No tags attached.
Issue History
2014-08-21 16:06TimurNew Issue
2014-08-22 09:40Brad KingNote Added: 0036664
2014-08-22 09:59TimurNote Added: 0036666
2014-09-02 10:18Brad KingNote Edited: 0036664bug_revision_view_page.php?bugnote_id=36664#r1560
2014-09-02 10:18Brad KingAssigned To => Brad King
2014-09-02 10:18Brad KingStatusnew => resolved
2014-09-02 10:18Brad KingResolutionopen => fixed
2014-09-02 10:18Brad KingFixed in Version => CMake 3.1
2014-09-02 10:18Brad KingTarget Version => CMake 3.1
2015-03-02 08:57Robert MaynardNote Added: 0038102
2015-03-02 08:57Robert MaynardStatusresolved => closed

Notes
(0036664)
Brad King   
2014-08-22 09:40   
(edited on: 2014-09-02 10:18)
AFAICT there is no "/ZW-" flag defined by cl, so it is not appropriate to add that to the flag table. Instead the VS generator should simply be taught to disable CompileAsWinRT for C sources when the rest of the target has it:

 VS: Do not compile C sources as WinRT
 http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=dd11ae8f [^]

There happens to be ongoing development right now to support Windows Phone and Store applications. There is a new VS_WINRT_COMPONENT target property to mark a shared library as a Windows Runtime component.

(0036666)
Timur   
2014-08-22 09:59   
Yes indeed unfortunately Microsoft did not provided /ZW- option.

Indeed I first implemented it as a patch to VS generator, but though that with flag table it would be cleaner.
(0038102)
Robert Maynard   
2015-03-02 08:57   
Closing resolved issues that have not been updated in more than 4 months.