Cpack IFW : Issue when building an installer with only one component
The goal when building a QT IFW installer is to get the packages/ folder, and upload the component(s) in it to our repository.
Sadly, when packaging a project with only one component, the information of the package is either wrong or missing.
Behavior with only one component
It seems that the information in cpack_add_component() and cpack_ifw_configure_component() are not used...
Instead, the package takes the CPACK_PACKAGE_NAME value (defaults to the project name) and all the package.xml tags resolve to default values.
Example :
CMakeLists.txt
Here we describe our component
# 1. Add information for cpack component
cpack_add_component(testComponent
DISPLAY_NAME "Test Component"
DESCRIPTION "This is test description.")
# 2. Add information for ifw component
cpack_ifw_configure_component(testComponent
ESSENTIAL
VIRTUAL
NAME "com.vendor.test"
VERSION "1.2.3"
RELEASE_DATE "2020-12-31"
SCRIPT "script/installscript.qs"
LICENSES "License" "${LICENSE_PATH}"
USER_INTERFACES "ui/readmecheckboxform.ui"
DEFAULT "true")
install(FILES "${LICENSE_PATH}" DESTINATION "." COMPONENT testComponent )
File tree
meta/package.xml
Path: build/_CPackPackages/win32/IFW/Online-Installer-1.0.0.0-win32
Package: packages/OnlineInstaller
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated by CPack 3.20.2 IFW generator for QtIFW 4.2.0 tools at 2021-08-10T07:56:32Z -->
<Package>
<DisplayName>OnlineInstaller</DisplayName>
<Description>OnlineInstaller built using CMake</Description>
<Name>OnlineInstaller</Name>
<Version>1.0.0</Version>
<ReleaseDate>2021-08-10</ReleaseDate>
<ForcedInstallation>true</ForcedInstallation>
</Package>
No UI, not the same packageName, displayName, no script, no license...
Behavior with two components (or more)
With at least one install(...) statement for each of our two components, packages/ is built correctly.
Example :
CMakeLists.txt
Let's add another component :
install(FILES "${LICENSE_PATH}" DESTINATION "." COMPONENT testComponent2 )
File tree
After packaging, we can see that out two packages are build accordingly, and our package.xml contains all the information :
com.vendor.test/meta/package.xml
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated by CPack 3.20.2 IFW generator for QtIFW 4.2.0 tools at 2021-08-10T08:21:10Z -->
<Package>
<DisplayName>Test Component</DisplayName>
<Description>This is test description.</Description>
<Name>com.vendor.test</Name>
<Version>1.2.3</Version>
<ReleaseDate>2020-12-31</ReleaseDate>
<Licenses>
<License name="License" file="license.txt"/>
</Licenses>
<ForcedInstallation>false</ForcedInstallation>
<RequiresAdminRights>false</RequiresAdminRights>
<Virtual>true</Virtual>
<Essential>true</Essential>
</Package>
Thanks and have a nice day.
Br.