MantisBT - CMake
View Issue Details
0016106CMakeCMakepublic2016-05-19 09:032016-06-10 14:31
Merlin1st 
Kitware Robot 
normalminoralways
closedmoved 
WindowsWindowsWindows 7
CMake 3.5.2 
 
0016106: Error generating UWP project with latest Visual Studio 2015
Command

cmake -G "Visual Studio 14 2015" -DCMAKE_SYSTEM_NAME=WindowsStore -DCMAKE_SYSTEM_VERSION=10.0

Always fails.
Create cmake project file CMakeLists.txt with content:

project(test)
add_library(${PROJECT_NAME} STATIC test.cpp)

then run command
cmake -G "Visual Studio 14 2015" -DCMAKE_SYSTEM_NAME=WindowsStore -DCMAKE_SYSTEM_VERSION=10.0

Generating fails.
No tags attached.
log CMakeError.log (9,777) 2016-05-19 09:03
https://public.kitware.com/Bug/file/5692/CMakeError.log
log CMakeOutput.log (4,862) 2016-05-19 09:03
https://public.kitware.com/Bug/file/5693/CMakeOutput.log
patch uwp_fix.patch (1,115) 2016-05-20 07:30
https://public.kitware.com/Bug/file/5694/uwp_fix.patch
patch uwp_fix2.patch (1,327) 2016-05-30 06:50
https://public.kitware.com/Bug/file/5696/uwp_fix2.patch
Issue History
2016-05-19 09:03Merlin1stNew Issue
2016-05-19 09:03Merlin1stFile Added: CMakeError.log
2016-05-19 09:03Merlin1stFile Added: CMakeOutput.log
2016-05-19 09:49Brad KingNote Added: 0041074
2016-05-20 07:29Merlin1stNote Added: 0041077
2016-05-20 07:30Merlin1stFile Added: uwp_fix.patch
2016-05-20 08:48Brad KingNote Added: 0041078
2016-05-23 08:04Merlin1stNote Added: 0041082
2016-05-23 09:26Brad KingNote Added: 0041083
2016-05-23 09:30Brad KingNote Added: 0041084
2016-05-23 09:46Merlin1stNote Added: 0041086
2016-05-23 09:49Merlin1stNote Added: 0041087
2016-05-23 09:56Brad KingNote Added: 0041088
2016-05-23 10:00Merlin1stNote Added: 0041089
2016-05-30 06:49Merlin1stNote Added: 0041109
2016-05-30 06:50Merlin1stFile Added: uwp_fix2.patch
2016-05-30 06:51Merlin1stNote Added: 0041110
2016-05-31 10:15Brad KingNote Added: 0041111
2016-06-10 14:29Kitware RobotNote Added: 0043004
2016-06-10 14:29Kitware RobotStatusnew => resolved
2016-06-10 14:29Kitware RobotResolutionopen => moved
2016-06-10 14:29Kitware RobotAssigned To => Kitware Robot
2016-06-10 14:31Kitware RobotStatusresolved => closed

Notes
(0041074)
Brad King   
2016-05-19 09:49   
It works for me (VS 2015 Update 2, Windows 10 host).

The content at the top of the CMakeError.log you attached shows what happens when CMake tries building a tiny test project. The first error-looking output is:

_ExpandProjectPriFile:
  C:\Program Files (x86)\Windows Kits\10\bin\x64\MakePri.exe Dump -IndexFile resources.pri -OutputFile cmTC_896fb.dir\Debug\resources.pri.xml -Verbose -Overwrite
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\AppxPackage\Microsoft.AppXPackage.Targets(1446,5): error APPX0002: Task 'ExpandPriContent' failed. The path is not of a legal form.

I'm not familiar enough with these MS tools to interpret that though.
(0041077)
Merlin1st   
2016-05-20 07:29   
I created patch that fixes this issue.
Please check attached file "uwp_fix.patch"
(0041078)
Brad King   
2016-05-20 08:48   
Re 0016106:0041077: Thanks. Can you explain what was wrong with the old code such that it works in some environments and not others, and why the new code will work in all environments? This will be useful for the commit message.
(0041082)
Merlin1st   
2016-05-23 08:04   
This is a Microsoft Visual Studio behaviour. MsBuild looking for resources.pri in the intermediates folder.
(0041083)
Brad King   
2016-05-23 09:26   
Re 0016106:0041082: Okay, but then why does it work on my machine (and the machines of those who contributed this feature in the first place) with the old code?

What version of MSBuild are you running?
(0041084)
Brad King   
2016-05-23 09:30   
For reference, the "$(TargetDir)resources.pri" path was added here:

 VS: Mark Windows Phone and Store targets as App Containers
 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=b8e40538 [^]
(0041086)
Merlin1st   
2016-05-23 09:46   
Really, I don't know. In my opinion, it is better to suppress both parameters <AppxPackageArtifactsDir> and <ProjectPriFullPath>. Let Visual Studio uses default values.
(0041087)
Merlin1st   
2016-05-23 09:49   
The msbuild version is 14.0.25123.0
(0041088)
Brad King   
2016-05-23 09:56   
Re 0016106:0041086: Perhaps, but I don't understand these tools myself and the original code came from Microsoft.

Gilles?
(0041089)
Merlin1st   
2016-05-23 10:00   
I see, and I have no idea. ))
(0041109)
Merlin1st   
2016-05-30 06:49   
I figured out that under windows 8.1 and upper everything is work fine.
Because msbuild (?) sets the internal variable AppxUseResourceIndexerApi into "true" and then skips build step which fails in other case:

Log:
Target "_ExpandProjectPriFile" skipped, due to false condition; ('$(AppxPackage)' == 'true' and '$(AppxUseResourceIndexerApi)' == 'false') was evaluated as ('True' == 'true' and 'true' == 'false').

With the default settings, the build is successful under all versions of Windows.
(0041110)
Merlin1st   
2016-05-30 06:51   
I uploaded updated patch (uwp_fix2.patch)
(0041111)
Brad King   
2016-05-31 10:15   
Re 0016106:0041110: Thanks. The uwp_fix2.patch change leaves the artifactDir variable unused. This led me to the surrounding context of the patch where the variable is set with a comment:

    https://cmake.org/gitweb?p=cmake.git;a=blob;f=Source/cmVisualStudio10TargetGenerator.cxx;hb=v3.5.2#l3105 [^]
    // Move the manifest to a project directory to avoid clashes
    std::string artifactDir = ...

This explains the reason that the non-default value is used. We cannot simply drop it.
(0043004)
Kitware Robot   
2016-06-10 14:29   
Resolving issue as `moved`.

This issue tracker is no longer used. Further discussion of this issue may take place in the current CMake Issues page linked in the banner at the top of this page.