View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0012930CMakeCMakepublic2012-02-03 07:162014-08-21 15:46
ReporterEugene Golushkov 
Assigned ToBrad King 
PrioritynormalSeverityfeatureReproducibilityhave not tried
PlatformOSOS Version
Product VersionCMake 2.8.8 
Target VersionCMake 2.8.10Fixed in VersionCMake 2.8.10 
Summary0012930: [patch] CMake does not support Visual Studio 11 WinRT project type
DescriptionCMake currently does not support setting project type as needed to develop WinRT applications for Windows 8 with the Visual Studio 10 generator.
Patch is based on a similar patch for .NET project types from here: [^]

Additional InformationThe attached patch adds support for two new project properties:
VS_WINRT_EXTENSIONS: Boolean property that correspond to "Enable Tailored Features" in Visual Studio 11 IDE.
VS_WINRT_REFERENCES: Semicolon-delimited list of *.winmd references to add to the project, which creates a new <ItemGroup>.
TagsNo tags attached.
Attached Filestxt file icon cmake_winrt.patch.txt [^] (3,796 bytes) 2012-02-03 07:17 [Show Content]
patch file icon 0001-VS11-Rename-Immersive-to-WindowsAppContainer-12930.patch [^] (1,425 bytes) 2012-08-21 12:10 [Show Content]

related to 0012586closedBrad King [patch] CMake does not support Visual Studio projects types or dotnet references with managed C++ 
related to 0013498closed CMake does not fully support Visual Studio 11 WinRT project type 
related to 0013511closedBrad King Add support for WinRT platforms and "metro" apps 
related to 0013749closed Cannot target Windows 8 RT from CMake without workarounds. 

Brad King (manager)
2012-02-03 10:23

The patch looks pretty good but needs a few tweaks. First, a compilation error:

- this->WriteString("<Immersive>true</Immersive>");
+ this->WriteString("<Immersive>true</Immersive>\n", 2);

Second, the WriteWinRTReferences method parses ;-separated lists on its own. CMake makes broad use of ;-separated lists and has a standard internal method called cmSystemTools::ExpandListArgument. Please convert the implementation to use that.
Eugene Golushkov (reporter)
2012-02-03 11:04

I will try to fix this, but I can not test my changes, as CMake can not bootstrap itself on Win8+VS11, and as primarily Mac developer I have no access to other Windows machines.
Eugene Golushkov (reporter)
2012-02-03 11:09

BTW, on Win8+VS11 it decide that
>//Does the compiler support headers like iostream.
Brad King (manager)
2012-02-03 14:30

Re 0012930:0028463: I just noticed that your pattern was taken from the change in 0012586 where I missed this ;-parsing issue. I'll take your patch as-is and then add a commit to fix up the list handling.
Brad King (manager)
2012-02-03 14:46

Applied patch with compilation fix:;a=commitdiff;h=9e01aefd [^]

and fixed the ;-separated value parsing:;a=commitdiff;h=a03447b3 [^]

Thanks for your contribution!

Re 0012930:0028464: While interesting, the problem is not in the scope of this issue.
Eugene Golushkov (reporter)
2012-08-21 11:36

In VS 2012 RTM things changed.

VS_WINRT_EXTENSIONS should create "<WindowsAppContainer>true</WindowsAppContainer>" tag instead of "<Immersive>true</Immersive>". Also ability to specify set_target_properties(X PROPERTIES COMPILE_FLAGS "/ZW") is crucial.
Brad King (manager)
2012-08-21 11:42

Re 0012930:0030717: VS 2012 is the official VS version 11 release. The VS 11 preview has expired so no one should be using it anymore. So we need "Immersive" for VS 10 and "WindowsAppContainer" for VS 11?
Eugene Golushkov (reporter)
2012-08-21 11:46

No, we don`t need Immersive at all - it was prerelease name of what is now known as WindowsAppContainer, and it always was VS11 aka VS2012 feature - no VS10 aka VS2010 involved.
Brad King (manager)
2012-08-21 12:11

How does "0001-VS11-Rename-Immersive-to-WindowsAppContainer-12930.patch" look?
Eugene Golushkov (reporter)
2012-08-21 12:15

"<WindowsAppContainer>true</WindowsAppContainer>" causes MSBuild to use another set of rules to build the project, another defaults, defines, API subset and so on. This setting is called "Windows Store App Support" in the VS2012 RTM.

In VS11 beta it also causes flag "/ZW" ("Consume Windows Runtime Extension") to be passed to the C++ compiler automatically. But in RTM this flag is not longer passed automatically, as there can be dependencies that are compatible with WinRT but not depended on it, like zlib and other. Therefore for projects that are actually depended on WinRT such flag should be passed manually, via set_target_properties(X PROPERTIES COMPILE_FLAGS "/ZW") for example, but now this flag is unrecognized and lost, despite that for example set_target_properties(X PROPERTIES COMPILE_FLAGS "/bigobj") flag is passed.

And last issue - if "<WindowsAppContainer>true</WindowsAppContainer>" is specified and no "Create/Use/Don`t use Precompiled Headers" ("/Yc", "/Yu", "/Y-") flag is specified explicitly - than MSBuild uses implicit default of "Use Precompiled Header" instead of usual "Don`t use" default. This behavior can not be suppressed via set_target_properties(X PROPERTIES COMPILE_FLAGS "/Y-"), so it would be nice if CMake generated files would always explicitly disable precompiled headers if they was not enabled by the user via "/Yc" or "/Yu' option. This can be done via default "<PrecompiledHeader>NotUsing</PrecompiledHeader>" subtag of <ClCompile> tag
Eugene Golushkov (reporter)
2012-08-21 12:17

Yeah, patch solves first of the three problems
Eugene Golushkov (reporter)
2012-08-21 12:24
edited on: 2012-08-21 12:24

BTW, I`m author of the Ogre`s WinRT port, and want to simplify bootstrapping process, as [^] is already too big.

Brad King (manager)
2012-08-21 12:48
edited on: 2012-08-21 13:03

Re 0012930:0030722: Patch for that problem applied:;a=commitdiff;h=4c9ae472 [^]

Re 0012930:0030721: The /ZW flag does not appear in our table of compiler flags:;a=blob;f=Source/cmVS10CLFlagTable.h;hb=v2.8.9 [^]

probably because it hasn't been updated for VS 11. We may need to generate a new one.

Try this patch for the precompiled header problem:
diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx

index 53b6a9b..45bb948 100644
--- a/Source/cmVisualStudio10TargetGenerator.cxx
+++ b/Source/cmVisualStudio10TargetGenerator.cxx
@@ -1492,6 +1492,7 @@ void cmVisualStudio10TargetGenerator::WriteLinkOptions(std::string const&

linkOptions.AddFlag("ImportLibrary", imLib.c_str());
   linkOptions.AddFlag("ProgramDataBaseFile", pdb.c_str());
+  linkOptions.AddFlag("PrecompiledHeader", "NotUsing");

Eugene Golushkov (reporter)
2012-08-21 12:55
edited on: 2012-08-21 12:55

No no no, it should be inside cmVisualStudio10TargetGenerator::WriteClOptions(), not inside cmVisualStudio10TargetGenerator::WriteLinkOptions()

Brad King (manager)
2012-08-21 13:07

Re 0012930:0030725: Oops! How about this:

diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx

index 53b6a9b..b8b57e6 100644
--- a/Source/cmVisualStudio10TargetGenerator.cxx
+++ b/Source/cmVisualStudio10TargetGenerator.cxx
@@ -1204,6 +1204,7 @@ bool cmVisualStudio10TargetGenerator::ComputeClOptions(
   // Get preprocessor definitions for this directory.
   std::string defineFlags = this->Target->GetMakefile()->GetDefineFlags();
+  clOptions.AddFlag("PrecompiledHeader", "NotUsing");
Eugene Golushkov (reporter)
2012-08-22 06:38
edited on: 2012-08-22 06:39

> + clOptions.AddFlag("PrecompiledHeader", "NotUsing");

Works like a charm, in both cases, when user ask to use pch, and when say nothing about it.

How about the last issue, "/ZW" flag? Can I help you somehow with it?

Eugene Golushkov (reporter)
2012-08-22 06:46
edited on: 2012-08-22 06:53

BTW, as "<WindowsAppContainer>true</WindowsAppContainer>" corresponds to the UI setting "Windows Store App Support", and "/ZW" flag corresponds to the "Consume Windows Runtime Extension" - may be rename VS_WINRT_EXTENSIONS that influence first but not the second setting to the VS_WINRT_STORE_APP or similar, to remove confusion?

BTW2: In VS2012 RTM all system API metadata was consolidated into the implicitly referenced Platfrom.winmd and Windows.winmd files, that makes VS_WINRT_REFERENCES unnecessary in many cases, when you need only system metadata. But to use such metadata (even those that are implicitly referenced) you need "/ZW" flag, so may be generate it implicitly if VS_WINRT_REFERENCES is set, even if it is empty ?

Brad King (manager)
2012-08-22 09:19

Re 0012930:0030732: Thanks for testing. Patch applied:;a=commitdiff;h=f0ae381c [^]

The /ZW flag problem is more general in that we haven't generated flag tables for the VS 11 tools. It's now a work in progress.
Brad King (manager)
2012-08-22 15:42

Re 0012930:0030734: This commit should add the ZW flag support:;a=commitdiff;h=9b2dda5d [^]

One may use this command:

  $ git show -C -C 9b2dda5d

in a CMake Git work tree to see the differences from the VS 10 flag table. ZW is among them.
Brad King (manager)
2012-08-29 09:55

Resolving as fixed for now because the main fixes have been merged to CMake's Git master branch.

Re 0012930:0030733: If you want to do this please base work off master as of commit 78b30939 or later.
Robert Maynard (manager)
2013-04-17 08:54

Closing resolved issues that have not been updated in more than 4 months.

 Issue History
Date Modified Username Field Change
2012-02-03 07:16 Eugene Golushkov New Issue
2012-02-03 07:17 Eugene Golushkov File Added: cmake_winrt.patch.txt
2012-02-03 09:04 Brad King Relationship added related to 0012586
2012-02-03 10:23 Brad King Note Added: 0028459
2012-02-03 11:04 Eugene Golushkov Note Added: 0028463
2012-02-03 11:09 Eugene Golushkov Note Added: 0028464
2012-02-03 14:30 Brad King Note Added: 0028467
2012-02-03 14:30 Brad King Assigned To => Brad King
2012-02-03 14:30 Brad King Status new => assigned
2012-02-03 14:46 Brad King Note Added: 0028468
2012-02-03 14:46 Brad King Status assigned => resolved
2012-02-03 14:46 Brad King Resolution open => fixed
2012-04-19 15:48 David Cole Fixed in Version => CMake 2.8.8
2012-04-19 15:48 David Cole Target Version => CMake 2.8.8
2012-08-21 11:36 Eugene Golushkov Note Added: 0030717
2012-08-21 11:36 Eugene Golushkov Status resolved => feedback
2012-08-21 11:36 Eugene Golushkov Resolution fixed => reopened
2012-08-21 11:42 Brad King Note Added: 0030718
2012-08-21 11:46 Eugene Golushkov Note Added: 0030719
2012-08-21 11:46 Eugene Golushkov Status feedback => assigned
2012-08-21 12:10 Brad King File Added: 0001-VS11-Rename-Immersive-to-WindowsAppContainer-12930.patch
2012-08-21 12:11 Brad King Note Added: 0030720
2012-08-21 12:11 Brad King Product Version CMake 2.8.7 => CMake 2.8.8
2012-08-21 12:11 Brad King Fixed in Version CMake 2.8.8 =>
2012-08-21 12:11 Brad King Target Version CMake 2.8.8 => CMake 2.8.10
2012-08-21 12:15 Eugene Golushkov Note Added: 0030721
2012-08-21 12:17 Eugene Golushkov Note Added: 0030722
2012-08-21 12:24 Eugene Golushkov Note Added: 0030723
2012-08-21 12:24 Eugene Golushkov Note Edited: 0030723
2012-08-21 12:48 Brad King Note Added: 0030724
2012-08-21 12:55 Eugene Golushkov Note Added: 0030725
2012-08-21 12:55 Eugene Golushkov Note Edited: 0030725
2012-08-21 13:03 Brad King Note Edited: 0030724
2012-08-21 13:07 Brad King Note Added: 0030726
2012-08-22 06:38 Eugene Golushkov Note Added: 0030732
2012-08-22 06:39 Eugene Golushkov Note Edited: 0030732
2012-08-22 06:46 Eugene Golushkov Note Added: 0030733
2012-08-22 06:53 Eugene Golushkov Note Edited: 0030733
2012-08-22 09:19 Brad King Note Added: 0030734
2012-08-22 15:42 Brad King Note Added: 0030735
2012-08-29 09:55 Brad King Note Added: 0030794
2012-08-29 09:55 Brad King Status assigned => resolved
2012-08-29 09:55 Brad King Resolution reopened => fixed
2012-08-29 09:55 Brad King Fixed in Version => CMake 2.8.10
2012-08-30 13:03 Brad King Relationship added related to 0013498
2012-09-03 10:21 Brad King Relationship added related to 0013511
2012-09-03 10:22 Brad King Relationship deleted related to 0013511
2012-09-03 10:25 Brad King Relationship added related to 0013511
2012-11-28 08:33 Brad King Relationship added related to 0013749
2013-04-17 08:54 Robert Maynard Note Added: 0032886
2013-04-17 08:54 Robert Maynard Status resolved => closed

Copyright © 2000 - 2018 MantisBT Team