CMake: More FilePath in Deployment data

Change-Id: I898a621a34558a28d4688a33aeb9bb9148df6901
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
This commit is contained in:
hjk
2022-10-14 14:23:25 +02:00
parent a1e960a27c
commit ec430787e5

View File

@@ -1093,28 +1093,28 @@ DeploymentData CMakeBuildSystem::deploymentData() const
{ {
DeploymentData result; DeploymentData result;
QDir sourceDir = project()->projectDirectory().toString(); FilePath sourceDir = project()->projectDirectory();
QDir buildDir = buildConfiguration()->buildDirectory().toString(); FilePath buildDir = buildConfiguration()->buildDirectory();
QString deploymentPrefix; QString deploymentPrefix;
QString deploymentFilePath = sourceDir.filePath("QtCreatorDeployment.txt"); FilePath deploymentFilePath = sourceDir.pathAppended("QtCreatorDeployment.txt");
bool hasDeploymentFile = QFileInfo::exists(deploymentFilePath); bool hasDeploymentFile = deploymentFilePath.exists();
if (!hasDeploymentFile) { if (!hasDeploymentFile) {
deploymentFilePath = buildDir.filePath("QtCreatorDeployment.txt"); deploymentFilePath = buildDir.pathAppended("QtCreatorDeployment.txt");
hasDeploymentFile = QFileInfo::exists(deploymentFilePath); hasDeploymentFile = deploymentFilePath.exists();
} }
if (!hasDeploymentFile) if (!hasDeploymentFile)
return result; return result;
deploymentPrefix = result.addFilesFromDeploymentFile(deploymentFilePath, deploymentPrefix = result.addFilesFromDeploymentFile(deploymentFilePath.toString(),
sourceDir.absolutePath()); sourceDir.toString());
for (const CMakeBuildTarget &ct : m_buildTargets) { for (const CMakeBuildTarget &ct : m_buildTargets) {
if (ct.targetType == ExecutableType || ct.targetType == DynamicLibraryType) { if (ct.targetType == ExecutableType || ct.targetType == DynamicLibraryType) {
if (!ct.executable.isEmpty() if (!ct.executable.isEmpty()
&& result.deployableForLocalFile(ct.executable).localFilePath() != ct.executable) { && result.deployableForLocalFile(ct.executable).localFilePath() != ct.executable) {
result.addFile(ct.executable, result.addFile(ct.executable,
deploymentPrefix + buildDir.relativeFilePath(ct.executable.toFileInfo().dir().path()), deploymentPrefix + buildDir.relativeChildPath(ct.executable).toString(),
DeployableFile::TypeExecutable); DeployableFile::TypeExecutable);
} }
} }