From 5e6f1f5dacf2f92635b81497b02ed73e6e7ea9af Mon Sep 17 00:00:00 2001 From: Cristian Adam Date: Wed, 17 Jan 2024 20:11:02 +0100 Subject: [PATCH] CMakePM: Fix adding qml files to targets using ${PROJECT_NAME} Instead of looking after the target name reported by CMake's file api e.g. mytarget, take the parameter name from the function that created the target. This way if the user used ${PROJECT_NAME} to mark the name of the target for qt_add_executable and qt_add_qml_module, when adding a qml file the proper function would be picked. Fixes: QTCREATORBUG-30218 Change-Id: I920f16d9f5a6b8a7a2fddb3ef7e97e0e3bccd464 Reviewed-by: Alessandro Portale --- src/plugins/cmakeprojectmanager/cmakebuildsystem.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/cmakeprojectmanager/cmakebuildsystem.cpp b/src/plugins/cmakeprojectmanager/cmakebuildsystem.cpp index 9ed58160eaf..a9856ae7b77 100644 --- a/src/plugins/cmakeprojectmanager/cmakebuildsystem.cpp +++ b/src/plugins/cmakeprojectmanager/cmakebuildsystem.cpp @@ -324,7 +324,7 @@ bool CMakeBuildSystem::addFiles(Node *context, const FilePaths &filePaths, FileP // Special case: when qt_add_executable and qt_add_qml_module use the same target name // then qt_add_qml_module function should be used - const std::string target_name = targetName.toStdString(); + const std::string target_name = function->Arguments().front().Value; auto add_qml_module_func = std::find_if(cmakeListFile.Functions.begin(), cmakeListFile.Functions.end(),