forked from qt-creator/qt-creator
CMake: Compile with QT_NO_CAST_FROM_ASCII
Change-Id: I23134b7eef222dcdb3425e2f2f6d62ab863009fe Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com> Reviewed-by: Daniel Teske <daniel.teske@digia.com>
This commit is contained in:
committed by
Daniel Teske
parent
b5bfb81508
commit
862629c57a
@@ -251,7 +251,7 @@ bool CMakeProject::parseCMakeLists()
|
||||
projectFiles.insert(node->path());
|
||||
} else {
|
||||
// Manually add the CMakeLists.txt file
|
||||
QString cmakeListTxt = projectDirectory() + "/CMakeLists.txt";
|
||||
QString cmakeListTxt = projectDirectory() + QLatin1String("/CMakeLists.txt");
|
||||
bool generated = false;
|
||||
fileList.append(new ProjectExplorer::FileNode(cmakeListTxt, ProjectExplorer::ProjectFileType, generated));
|
||||
projectFiles.insert(cmakeListTxt);
|
||||
@@ -279,13 +279,13 @@ bool CMakeProject::parseCMakeLists()
|
||||
|
||||
// TOOD this code ain't very pretty ...
|
||||
m_uicCommand.clear();
|
||||
QFile cmakeCache(activeBC->buildDirectory() + "/CMakeCache.txt");
|
||||
QFile cmakeCache(activeBC->buildDirectory() + QLatin1String("/CMakeCache.txt"));
|
||||
cmakeCache.open(QIODevice::ReadOnly);
|
||||
while (!cmakeCache.atEnd()) {
|
||||
QString line = cmakeCache.readLine();
|
||||
QByteArray line = cmakeCache.readLine();
|
||||
if (line.startsWith("QT_UIC_EXECUTABLE")) {
|
||||
if (int pos = line.indexOf('=')) {
|
||||
m_uicCommand = line.mid(pos + 1).trimmed();
|
||||
m_uicCommand = QString::fromLocal8Bit(line.mid(pos + 1).trimmed());
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -542,7 +542,7 @@ bool CMakeProject::fromMap(const QVariantMap &map)
|
||||
Kit *k = copw.kit();
|
||||
Target *t = new Target(this, k);
|
||||
CMakeBuildConfiguration *bc(new CMakeBuildConfiguration(t));
|
||||
bc->setDefaultDisplayName("all");
|
||||
bc->setDefaultDisplayName(QLatin1String("all"));
|
||||
bc->setUseNinja(copw.useNinja());
|
||||
bc->setBuildDirectory(copw.buildDirectory());
|
||||
ProjectExplorer::BuildStepList *buildSteps = bc->stepList(ProjectExplorer::Constants::BUILDSTEPS_BUILD);
|
||||
@@ -553,7 +553,7 @@ bool CMakeProject::fromMap(const QVariantMap &map)
|
||||
|
||||
MakeStep *cleanMakeStep = new MakeStep(cleanSteps);
|
||||
cleanSteps->insertStep(0, cleanMakeStep);
|
||||
cleanMakeStep->setAdditionalArguments("clean");
|
||||
cleanMakeStep->setAdditionalArguments(QLatin1String("clean"));
|
||||
cleanMakeStep->setClean(true);
|
||||
|
||||
t->addBuildConfiguration(bc);
|
||||
@@ -594,11 +594,11 @@ bool CMakeProject::fromMap(const QVariantMap &map)
|
||||
|
||||
parseCMakeLists();
|
||||
|
||||
if (!hasUserFile && hasBuildTarget("all")) {
|
||||
if (!hasUserFile && hasBuildTarget(QLatin1String("all"))) {
|
||||
MakeStep *makeStep = qobject_cast<MakeStep *>(
|
||||
activeTarget()->activeBuildConfiguration()->stepList(ProjectExplorer::Constants::BUILDSTEPS_BUILD)->at(0));
|
||||
Q_ASSERT(makeStep);
|
||||
makeStep->setBuildTarget("all", true);
|
||||
makeStep->setBuildTarget(QLatin1String("all"), true);
|
||||
}
|
||||
|
||||
connect(Core::EditorManager::instance(), SIGNAL(editorAboutToClose(Core::IEditor*)),
|
||||
@@ -691,7 +691,7 @@ void CMakeProject::updateRunConfigurations(Target *t)
|
||||
continue;
|
||||
if (ct.executable.isEmpty())
|
||||
continue;
|
||||
if (ct.title.endsWith("/fast"))
|
||||
if (ct.title.endsWith(QLatin1String("/fast")))
|
||||
continue;
|
||||
QList<CMakeRunConfiguration *> list = existingRunConfigurations.values(ct.title);
|
||||
if (!list.isEmpty()) {
|
||||
@@ -743,7 +743,7 @@ void CMakeProject::createUiCodeModelSupport()
|
||||
|
||||
// Find all ui files
|
||||
foreach (const QString &uiFile, m_files) {
|
||||
if (uiFile.endsWith(".ui")) {
|
||||
if (uiFile.endsWith(QLatin1String(".ui"))) {
|
||||
// UI file, not convert to
|
||||
QString uiHeaderFilePath = uiHeaderFile(uiFile);
|
||||
QMap<QString, CMakeUiCodeModelSupport *>::iterator it
|
||||
@@ -872,7 +872,7 @@ QString CMakeFile::suggestedFileName() const
|
||||
|
||||
QString CMakeFile::mimeType() const
|
||||
{
|
||||
return Constants::CMAKEMIMETYPE;
|
||||
return QLatin1String(Constants::CMAKEMIMETYPE);
|
||||
}
|
||||
|
||||
|
||||
@@ -1042,12 +1042,12 @@ void CMakeCbpParser::parseBuildTarget()
|
||||
m_buildTargetType = false;
|
||||
m_buildTarget.clear();
|
||||
|
||||
if (attributes().hasAttribute("title"))
|
||||
m_buildTarget.title = attributes().value("title").toString();
|
||||
if (attributes().hasAttribute(QLatin1String("title")))
|
||||
m_buildTarget.title = attributes().value(QLatin1String("title")).toString();
|
||||
while (!atEnd()) {
|
||||
readNext();
|
||||
if (isEndElement()) {
|
||||
if (m_buildTargetType || m_buildTarget.title == "all" || m_buildTarget.title == "install") {
|
||||
if (m_buildTargetType || m_buildTarget.title == QLatin1String("all") || m_buildTarget.title == QLatin1String("install")) {
|
||||
m_buildTargets.append(m_buildTarget);
|
||||
}
|
||||
return;
|
||||
@@ -1063,15 +1063,19 @@ void CMakeCbpParser::parseBuildTarget()
|
||||
|
||||
void CMakeCbpParser::parseBuildTargetOption()
|
||||
{
|
||||
if (attributes().hasAttribute("output")) {
|
||||
m_buildTarget.executable = attributes().value("output").toString();
|
||||
} else if (attributes().hasAttribute("type") && (attributes().value("type") == "1" || attributes().value("type") == "0")) {
|
||||
if (attributes().hasAttribute(QLatin1String("output"))) {
|
||||
m_buildTarget.executable = attributes().value(QLatin1String("output")).toString();
|
||||
} else if (attributes().hasAttribute(QLatin1String("type"))
|
||||
&& (attributes().value(QLatin1String("type")) == QLatin1String("1")
|
||||
|| attributes().value(QLatin1String("type")) == QLatin1String("0"))) {
|
||||
m_buildTargetType = true;
|
||||
} else if (attributes().hasAttribute("type") && (attributes().value("type") == "3" || attributes().value("type") == "2")) {
|
||||
} else if (attributes().hasAttribute(QLatin1String("type"))
|
||||
&& (attributes().value(QLatin1String("type")) == QLatin1String("3")
|
||||
|| attributes().value(QLatin1String("type")) == QLatin1String("2"))) {
|
||||
m_buildTargetType = true;
|
||||
m_buildTarget.library = true;
|
||||
} else if (attributes().hasAttribute("working_dir")) {
|
||||
m_buildTarget.workingDirectory = attributes().value("working_dir").toString();
|
||||
} else if (attributes().hasAttribute(QLatin1String("working_dir"))) {
|
||||
m_buildTarget.workingDirectory = attributes().value(QLatin1String("working_dir")).toString();
|
||||
}
|
||||
while (!atEnd()) {
|
||||
readNext();
|
||||
@@ -1092,11 +1096,11 @@ QString CMakeCbpParser::projectName() const
|
||||
|
||||
void CMakeCbpParser::parseOption()
|
||||
{
|
||||
if (attributes().hasAttribute("title"))
|
||||
m_projectName = attributes().value("title").toString();
|
||||
if (attributes().hasAttribute(QLatin1String("title")))
|
||||
m_projectName = attributes().value(QLatin1String("title")).toString();
|
||||
|
||||
if (attributes().hasAttribute("compiler"))
|
||||
m_compiler = attributes().value("compiler").toString();
|
||||
if (attributes().hasAttribute(QLatin1String("compiler")))
|
||||
m_compiler = attributes().value(QLatin1String("compiler")).toString();
|
||||
|
||||
while (!atEnd()) {
|
||||
readNext();
|
||||
@@ -1126,8 +1130,8 @@ void CMakeCbpParser::parseMakeCommand()
|
||||
|
||||
void CMakeCbpParser::parseBuildTargetBuild()
|
||||
{
|
||||
if (attributes().hasAttribute("command"))
|
||||
m_buildTarget.makeCommand = attributes().value("command").toString();
|
||||
if (attributes().hasAttribute(QLatin1String("command")))
|
||||
m_buildTarget.makeCommand = attributes().value(QLatin1String("command")).toString();
|
||||
while (!atEnd()) {
|
||||
readNext();
|
||||
if (isEndElement()) {
|
||||
@@ -1140,8 +1144,8 @@ void CMakeCbpParser::parseBuildTargetBuild()
|
||||
|
||||
void CMakeCbpParser::parseBuildTargetClean()
|
||||
{
|
||||
if (attributes().hasAttribute("command"))
|
||||
m_buildTarget.makeCleanCommand = attributes().value("command").toString();
|
||||
if (attributes().hasAttribute(QLatin1String("command")))
|
||||
m_buildTarget.makeCleanCommand = attributes().value(QLatin1String("command")).toString();
|
||||
while (!atEnd()) {
|
||||
readNext();
|
||||
if (isEndElement()) {
|
||||
@@ -1171,19 +1175,19 @@ void CMakeCbpParser::parseAdd()
|
||||
// CMake only supports <Add option=\> and <Add directory=\>
|
||||
const QXmlStreamAttributes addAttributes = attributes();
|
||||
|
||||
const QString includeDirectory = addAttributes.value("directory").toString();
|
||||
const QString includeDirectory = addAttributes.value(QLatin1String("directory")).toString();
|
||||
// allow adding multiple times because order happens
|
||||
if (!includeDirectory.isEmpty()) {
|
||||
m_includeFiles.append(includeDirectory);
|
||||
}
|
||||
|
||||
QString compilerOption = addAttributes.value("option").toString();
|
||||
QString compilerOption = addAttributes.value(QLatin1String("option")).toString();
|
||||
// defining multiple times a macro to the same value makes no sense
|
||||
if (!compilerOption.isEmpty() && !m_compilerOptions.contains(compilerOption)) {
|
||||
m_compilerOptions.append(compilerOption);
|
||||
int macroNameIndex = compilerOption.indexOf("-D") + 2;
|
||||
int macroNameIndex = compilerOption.indexOf(QLatin1String("-D")) + 2;
|
||||
if (macroNameIndex != 1) {
|
||||
int assignIndex = compilerOption.indexOf('=', macroNameIndex);
|
||||
int assignIndex = compilerOption.indexOf(QLatin1Char('='), macroNameIndex);
|
||||
if (assignIndex != -1) {
|
||||
compilerOption[assignIndex] = ' ';
|
||||
}
|
||||
@@ -1206,7 +1210,7 @@ void CMakeCbpParser::parseAdd()
|
||||
void CMakeCbpParser::parseUnit()
|
||||
{
|
||||
//qDebug()<<stream.attributes().value("filename");
|
||||
QString fileName = attributes().value("filename").toString();
|
||||
QString fileName = attributes().value(QLatin1String("filename")).toString();
|
||||
m_parsingCmakeUnit = false;
|
||||
while (!atEnd()) {
|
||||
readNext();
|
||||
@@ -1218,9 +1222,9 @@ void CMakeCbpParser::parseUnit()
|
||||
} else {
|
||||
bool generated = false;
|
||||
QString onlyFileName = QFileInfo(fileName).fileName();
|
||||
if ( (onlyFileName.startsWith("moc_") && onlyFileName.endsWith(".cxx"))
|
||||
|| (onlyFileName.startsWith("ui_") && onlyFileName.endsWith(".h"))
|
||||
|| (onlyFileName.startsWith("qrc_") && onlyFileName.endsWith(".cxx")))
|
||||
if ( (onlyFileName.startsWith(QLatin1String("moc_")) && onlyFileName.endsWith(QLatin1String(".cxx")))
|
||||
|| (onlyFileName.startsWith(QLatin1String("ui_")) && onlyFileName.endsWith(QLatin1String(".h")))
|
||||
|| (onlyFileName.startsWith(QLatin1String("qrc_")) && onlyFileName.endsWith(QLatin1String(".cxx"))))
|
||||
generated = true;
|
||||
|
||||
if (fileName.endsWith(QLatin1String(".qrc")))
|
||||
@@ -1241,7 +1245,7 @@ void CMakeCbpParser::parseUnit()
|
||||
|
||||
void CMakeCbpParser::parseUnitOption()
|
||||
{
|
||||
if (attributes().hasAttribute("virtualFolder"))
|
||||
if (attributes().hasAttribute(QLatin1String("virtualFolder")))
|
||||
m_parsingCmakeUnit = true;
|
||||
|
||||
while (!atEnd()) {
|
||||
|
Reference in New Issue
Block a user