forked from qt-creator/qt-creator
CMake: Write creators settings into build directory
Write a file qtcsettings.cmake into the build directory. This file contains all applicable CMake configuration settings that creator wants to set. Use "cmake -C qtcsettings.cmake .." to reconfigure on the command line to make use of this file. Change-Id: I4a69d082c50bb66e60b4eec1b3155df53e00734d Reviewed-by: Cristian Adam <cristian.adam@qt.io> Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
This commit is contained in:
@@ -149,6 +149,24 @@ CMakeConfigItem::Type CMakeConfigItem::typeStringToType(const QByteArray &type)
|
||||
return CMakeConfigItem::INTERNAL;
|
||||
}
|
||||
|
||||
QString CMakeConfigItem::typeToTypeString(const CMakeConfigItem::Type t)
|
||||
{
|
||||
switch (t) {
|
||||
case CMakeProjectManager::CMakeConfigItem::FILEPATH:
|
||||
return "FILEPATH";
|
||||
case CMakeProjectManager::CMakeConfigItem::PATH:
|
||||
return "PATH";
|
||||
case CMakeProjectManager::CMakeConfigItem::STRING:
|
||||
return "STRING";
|
||||
case CMakeProjectManager::CMakeConfigItem::INTERNAL:
|
||||
return "INTERNAL";
|
||||
case CMakeProjectManager::CMakeConfigItem::STATIC:
|
||||
return "STATIC";
|
||||
case CMakeConfigItem::BOOL:
|
||||
return "BOOL";
|
||||
}
|
||||
}
|
||||
|
||||
Utils::optional<bool> CMakeConfigItem::toBool(const QByteArray &value)
|
||||
{
|
||||
// Taken from CMakes if(<constant>) documentation:
|
||||
@@ -367,6 +385,18 @@ QString CMakeConfigItem::toArgument(const Utils::MacroExpander *expander) const
|
||||
return "-D" + toString(expander);
|
||||
}
|
||||
|
||||
QString CMakeConfigItem::toCMakeSetLine(const Utils::MacroExpander *expander) const
|
||||
{
|
||||
if (isUnset) {
|
||||
return QString("unset(\"%1\" CACHE)").arg(QString::fromUtf8(key));
|
||||
}
|
||||
return QString("set(\"%1\" \"%2\" CACHE \"%3\" \"%4\" FORCE)")
|
||||
.arg(QString::fromUtf8(key))
|
||||
.arg(expandedValue(expander))
|
||||
.arg(typeToTypeString(type))
|
||||
.arg(QString::fromUtf8(documentation));
|
||||
}
|
||||
|
||||
bool CMakeConfigItem::operator==(const CMakeConfigItem &o) const
|
||||
{
|
||||
// type, isAdvanced and documentation do not matter for a match!
|
||||
|
||||
Reference in New Issue
Block a user