forked from qt-creator/qt-creator
QmlProjectExporter: Initialize CMakeLists.txt.shared before modification
Fixes: QDS-15419 Change-Id: I5b68b82379fb03da7eceef123861d3858a095dfb Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
This commit is contained in:
@@ -601,6 +601,15 @@ void CMakeGenerator::createWriter()
|
||||
|
||||
const Utils::FilePath rootPath = project->projectDirectory();
|
||||
const Utils::FilePath settingsFile = rootPath.pathAppended("CMakeLists.txt.shared");
|
||||
|
||||
if (!settingsFile.exists()) {
|
||||
const QString sharedTemplate = CMakeWriter::readTemplate(":/templates/cmake_shared");
|
||||
const QString sharedContent = sharedTemplate.arg(writer->identifier());
|
||||
CMakeWriter::writeFile(settingsFile, sharedContent);
|
||||
m_writer = writer;
|
||||
return;
|
||||
}
|
||||
|
||||
Utils::PersistentSettingsReader reader;
|
||||
reader.load(settingsFile);
|
||||
auto store = reader.restoreValues();
|
||||
|
@@ -47,12 +47,6 @@ void CMakeWriterLib::writeRootCMakeFile(const NodePtr &node) const
|
||||
|
||||
createDependencies(node->dir);
|
||||
|
||||
const Utils::FilePath sharedFile = node->dir.pathAppended("CMakeLists.txt.shared");
|
||||
if (!sharedFile.exists()) {
|
||||
const QString sharedTemplate = readTemplate(":/templates/cmake_shared");
|
||||
writeFile(sharedFile, sharedTemplate);
|
||||
}
|
||||
|
||||
const Utils::FilePath file = node->dir.pathAppended("CMakeLists.txt");
|
||||
if (!file.exists()) {
|
||||
QString fileSection = "";
|
||||
|
@@ -74,12 +74,6 @@ void CMakeWriterV1::writeRootCMakeFile(const NodePtr &node) const
|
||||
|
||||
createDependencies(node->dir);
|
||||
|
||||
const Utils::FilePath sharedFile = node->dir.pathAppended("CMakeLists.txt.shared");
|
||||
if (!sharedFile.exists()) {
|
||||
const QString sharedTemplate = readTemplate(":/templates/cmake_shared");
|
||||
writeFile(sharedFile, sharedTemplate);
|
||||
}
|
||||
|
||||
const Utils::FilePath file = node->dir.pathAppended("CMakeLists.txt");
|
||||
if (!file.exists()) {
|
||||
const QString appName = parent()->projectName() + "App";
|
||||
|
@@ -13,4 +13,8 @@
|
||||
<variable>Version</variable>
|
||||
<value type="int">22</value>
|
||||
</data>
|
||||
<data>
|
||||
<variable>CMake Generator</variable>
|
||||
<value type="int">%1</value>
|
||||
</data>
|
||||
</qtcreator>
|
||||
|
Reference in New Issue
Block a user