VS: Wrong appxManifest if OUTPUT_NAME != target name
CMakeLists.txt:
project(test)
add_executable(test test.c)
set_target_properties(test PROPERTIES OUTPUT_NAME app)
test.c:
int main() {
}
Run:
cmake -S . -B out -D CMAKE_SYSTEM_NAME=WindowsStore -D CMAKE_SYSTEM_VERSION=10.0
Result out/test.dir/package.appxManifest:
<?xml version="1.0" encoding="utf-8"?>
<Package
xmlns="http://schemas.microsoft.com/appx/manifest/foundation/windows10" xmlns:mp="http://schemas.microsoft.com/appx/2014/phone/manifest"
xmlns:uap="http://schemas.microsoft.com/appx/manifest/uap/windows10"
IgnorableNamespaces="uap mp">
<Identity Name="33AD70F9-17D8-32F6-9C92-D5EEB7D9D699" Publisher="CN=CMake" Version="1.0.0.0" />
<mp:PhoneIdentity PhoneProductId="33AD70F9-17D8-32F6-9C92-D5EEB7D9D699" PhonePublisherId="00000000-0000-0000-0000-000000000000"/>
<Properties>
<DisplayName>test</DisplayName>
<PublisherDisplayName>CMake</PublisherDisplayName>
<Logo>test.dir\StoreLogo.png</Logo>
</Properties>
<Dependencies>
<TargetDeviceFamily Name="Windows.Universal" MinVersion="10.0.0.0" MaxVersionTested="10.0.0.0" />
</Dependencies>
<Resources>
<Resource Language="x-generate" />
</Resources>
<Applications>
<Application Id="App" Executable="test.exe" EntryPoint="test.App">
<uap:VisualElements
DisplayName="test"
Description="test"
BackgroundColor="#336699"
Square150x150Logo="test.dir\Logo.png"
Square44x44Logo="test.dir\SmallLogo44x44.png">
<uap:SplashScreen Image="test.dir\SplashScreen.png" />
</uap:VisualElements>
</Application>
</Applications>
</Package>
This results in cmake --build out
error:
out\test.dir\package.appxManifest : error APPX0703: Manifest references file 'test.exe' which is not part of the payload.
The issue:
<Application Id="App" Executable="test.exe" EntryPoint="test.App">
must be
<Application Id="App" Executable="app.exe" EntryPoint="app.App">
I suppose the reason is Source/cmVisualStudio10TargetGenerator.cxx#L5321-L5322
std::string targetNameXML =
cmVS10EscapeXML(this->GeneratorTarget->GetName());
and maybe a wrong test case Tests/VSWinStorePhone/cmake/Package_vc14.store.appxmanifest.in#L25
<Application Id="App" Executable="$targetnametoken$.exe" EntryPoint="@SHORT_NAME@.App">
Edited by Brad King