forked from qt-creator/qt-creator
CMake: create generated file paths without QDir::cleanPath
Change-Id: I49913032fb95aff8357da7aa077eabd5907d53ca Reviewed-by: hjk <hjk@qt.io> Reviewed-by: Cristian Adam <cristian.adam@qt.io>
This commit is contained in:
@@ -323,9 +323,8 @@ bool CMakeBuildSystem::addFiles(Node *context, const FilePaths &filePaths, FileP
|
|||||||
|
|
||||||
FilePaths CMakeBuildSystem::filesGeneratedFrom(const FilePath &sourceFile) const
|
FilePaths CMakeBuildSystem::filesGeneratedFrom(const FilePath &sourceFile) const
|
||||||
{
|
{
|
||||||
QFileInfo fi = sourceFile.toFileInfo();
|
|
||||||
FilePath project = projectDirectory();
|
FilePath project = projectDirectory();
|
||||||
FilePath baseDirectory = FilePath::fromString(fi.absolutePath());
|
FilePath baseDirectory = sourceFile.parentDir();
|
||||||
|
|
||||||
while (baseDirectory.isChildOf(project)) {
|
while (baseDirectory.isChildOf(project)) {
|
||||||
const FilePath cmakeListsTxt = baseDirectory.pathAppended("CMakeLists.txt");
|
const FilePath cmakeListsTxt = baseDirectory.pathAppended("CMakeLists.txt");
|
||||||
@@ -334,22 +333,19 @@ FilePaths CMakeBuildSystem::filesGeneratedFrom(const FilePath &sourceFile) const
|
|||||||
baseDirectory = baseDirectory.parentDir();
|
baseDirectory = baseDirectory.parentDir();
|
||||||
}
|
}
|
||||||
|
|
||||||
QDir srcDirRoot = QDir(project.toString());
|
const FilePath relativePath = baseDirectory.relativePath(project);
|
||||||
QString relativePath = srcDirRoot.relativeFilePath(baseDirectory.toString());
|
FilePath generatedFilePath = cmakeBuildConfiguration()->buildDirectory().resolvePath(
|
||||||
QDir buildDir = QDir(cmakeBuildConfiguration()->buildDirectory().toString());
|
relativePath);
|
||||||
QString generatedFilePath = buildDir.absoluteFilePath(relativePath);
|
|
||||||
|
|
||||||
if (fi.suffix() == "ui") {
|
if (sourceFile.suffix() == "ui") {
|
||||||
generatedFilePath += "/ui_";
|
generatedFilePath = generatedFilePath
|
||||||
generatedFilePath += fi.completeBaseName();
|
.pathAppended("ui_" + sourceFile.completeBaseName() + ".h")
|
||||||
generatedFilePath += ".h";
|
.cleanPath();
|
||||||
return {FilePath::fromString(QDir::cleanPath(generatedFilePath))};
|
return {generatedFilePath};
|
||||||
}
|
}
|
||||||
if (fi.suffix() == "scxml") {
|
if (sourceFile.suffix() == "scxml") {
|
||||||
generatedFilePath += "/";
|
generatedFilePath = generatedFilePath.pathAppended(sourceFile.completeBaseName());
|
||||||
generatedFilePath += QDir::cleanPath(fi.completeBaseName());
|
return {generatedFilePath.stringAppended(".h"), generatedFilePath.stringAppended(".cpp")};
|
||||||
return {FilePath::fromString(generatedFilePath + ".h"),
|
|
||||||
FilePath::fromString(generatedFilePath + ".cpp")};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Other types will be added when adapters for their compilers become available.
|
// TODO: Other types will be added when adapters for their compilers become available.
|
||||||
|
|||||||
Reference in New Issue
Block a user