forked from qt-creator/qt-creator
CMake: Do not treat project with the empty string as a name as invalid
CMake will happily accept the empty string as a project name, so do not treat that is invalid in Creator. Apparently the empty project name will get generated by CMake itself if no project() command is found in the top level CMakeLists.txt file. Make sure to set a sensible name if the top-level project has no name, using the directory name of the source directory instead. Change-Id: I3b861daa13c1d0fec31c294ef0ac15338310020d Fixes: QTCREATORBUG-24044 Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
@@ -581,6 +581,8 @@ std::pair<std::unique_ptr<CMakeProjectNode>, QSet<FilePath>> generateRootProject
|
||||
= findOrDefault(data.codemodel.projects, equal(&FileApiDetails::Project::parent, -1));
|
||||
if (!topLevelProject.name.isEmpty())
|
||||
result.first->setDisplayName(topLevelProject.name);
|
||||
else
|
||||
result.first->setDisplayName(sourceDirectory.fileName());
|
||||
|
||||
QHash<FilePath, ProjectNode *> cmakeListsNodes = addCMakeLists(result.first.get(),
|
||||
std::move(data.cmakeListNodes));
|
||||
|
||||
Reference in New Issue
Block a user