mirror of
https://gitlab.kitware.com/cmake/cmake.git
synced 2026-09-25 04:09:36 +03:00
presets: Add defined listings with unavailable reasons
Add workflow and per-type defined values to cmake --list-presets. Each -defined value lists every non-hidden preset of the selected type and explains why unavailable presets cannot be used. The defined value is an alias for configure-defined. Support --list-presets=defined in cmake build and workflow modes, ctest, and cpack. Propagate configure preset unavailability to dependent build, test, package, and workflow presets. Fixes: #28016, #26118
This commit is contained in:
+27
-7
@@ -735,9 +735,16 @@ Options
|
||||
|
||||
.. option:: --list-presets[=<type>]
|
||||
|
||||
Lists the available presets of the specified ``<type>``. Valid values for
|
||||
``<type>`` are ``configure``, ``build``, ``test``, ``package``, or ``all``.
|
||||
If ``<type>`` is omitted, ``configure`` is assumed.
|
||||
Lists presets according to the specified ``<type>``. Valid values are
|
||||
``configure``, ``build``, ``test``, ``package``, ``workflow``, ``all``, or
|
||||
any of those values with ``-defined`` appended. The ``defined`` value is an
|
||||
alias for ``configure-defined``. If ``<type>`` is omitted, ``configure`` is
|
||||
assumed.
|
||||
|
||||
The values without the ``-defined`` suffix list available presets. The
|
||||
suffixed values list all non-hidden defined presets of the selected type,
|
||||
including unavailable presets with the reason they cannot be used. The
|
||||
``all`` and ``all-defined`` values select every preset type.
|
||||
|
||||
.. versionchanged:: 4.4
|
||||
If :cmake-option:`--presets-file` is specified, the presets defined in the
|
||||
@@ -746,6 +753,9 @@ Options
|
||||
contain ``CMakePresets.json`` and/or ``CMakeUserPresets.json``.
|
||||
In prior versions, the latter was strictly required.
|
||||
|
||||
.. versionadded:: 4.5
|
||||
Support for the ``workflow``, ``defined``, and ``-defined`` values.
|
||||
|
||||
.. option:: --debugger
|
||||
|
||||
Enables interactive debugging of the CMake language. CMake exposes a
|
||||
@@ -845,9 +855,11 @@ following options:
|
||||
If ``--presets-file`` is given, presets defined in ``CMakePresets.json`` and
|
||||
``CMakeUserPresets.json`` will be ignored.
|
||||
|
||||
.. option:: --list-presets
|
||||
.. option:: --list-presets[=defined]
|
||||
|
||||
Lists the available build presets.
|
||||
Lists the available build presets. With ``defined``, all non-hidden defined
|
||||
build presets are listed, including unavailable presets with the reason they
|
||||
cannot be used.
|
||||
|
||||
.. versionchanged:: 4.4
|
||||
``cmake --build <dir> --list-presets`` no longer needs to be called from
|
||||
@@ -856,6 +868,9 @@ following options:
|
||||
in the given ``<file>`` will be listed; otherwise, the presets file(s) are
|
||||
inferred from the current build directory's ``CMakeCache.txt``.
|
||||
|
||||
.. versionadded:: 4.5
|
||||
Support for the ``defined`` value.
|
||||
|
||||
.. option:: -j [<jobs>], --parallel [<jobs>]
|
||||
|
||||
.. versionadded:: 3.12
|
||||
@@ -1979,9 +1994,11 @@ The options are:
|
||||
If ``--presets-file`` is given, presets defined in ``CMakePresets.json`` and
|
||||
``CMakeUserPresets.json`` will be ignored.
|
||||
|
||||
.. option:: --list-presets
|
||||
.. option:: --list-presets[=defined]
|
||||
|
||||
Lists the available workflow presets.
|
||||
Lists the available workflow presets. With ``defined``, all defined
|
||||
workflow presets are listed. Unavailable presets are shown with the first
|
||||
unavailable step and its reason.
|
||||
|
||||
.. versionchanged:: 4.4
|
||||
If :cmake-workflow-option:`--presets-file` is specified, neither of
|
||||
@@ -1990,6 +2007,9 @@ The options are:
|
||||
Otherwise, they are required to be present in the top level source
|
||||
directory. In prior versions, this was strictly required.
|
||||
|
||||
.. versionadded:: 4.5
|
||||
Support for the ``defined`` value.
|
||||
|
||||
.. option:: --fresh
|
||||
|
||||
Perform a fresh configuration of the build tree, which has the same effect
|
||||
|
||||
@@ -141,9 +141,11 @@ Options
|
||||
If ``--presets-file`` is given, presets defined in ``CMakePresets.json`` and
|
||||
``CMakeUserPresets.json`` will be ignored.
|
||||
|
||||
.. option:: --list-presets
|
||||
.. option:: --list-presets[=defined]
|
||||
|
||||
Lists the available package presets.
|
||||
Lists the available package presets. With ``defined``, all non-hidden
|
||||
defined package presets are listed, including unavailable presets with the
|
||||
reason they cannot be used.
|
||||
|
||||
.. versionchanged:: 4.4
|
||||
If :cpack-option:`--presets-file` is specified, neither of
|
||||
@@ -152,6 +154,9 @@ Options
|
||||
Otherwise, they are required to be present in the top level source
|
||||
directory. In prior versions, this was strictly required.
|
||||
|
||||
.. versionadded:: 4.5
|
||||
Support for the ``defined`` value.
|
||||
|
||||
.. include:: include/OPTIONS_HELP.rst
|
||||
|
||||
See Also
|
||||
|
||||
@@ -96,9 +96,11 @@ The options for running tests are:
|
||||
If ``--presets-file`` is given, presets defined in ``CMakePresets.json`` and
|
||||
``CMakeUserPresets.json`` will be ignored.
|
||||
|
||||
.. option:: --list-presets
|
||||
.. option:: --list-presets[=defined]
|
||||
|
||||
Lists the available test presets. The current working directory must contain
|
||||
Lists the available test presets. With ``defined``, all non-hidden defined
|
||||
test presets are listed, including unavailable presets with the reason they
|
||||
cannot be used. The current working directory must contain
|
||||
``CMakePresets.json`` and/or ``CMakeUserPresets.json``.
|
||||
|
||||
.. versionchanged:: 4.4
|
||||
@@ -108,6 +110,9 @@ The options for running tests are:
|
||||
Otherwise, they are required to be present in the top level source
|
||||
directory. In prior versions, this was strictly required.
|
||||
|
||||
.. versionadded:: 4.5
|
||||
Support for the ``defined`` value.
|
||||
|
||||
.. option:: -C <cfg>, --build-config <cfg>
|
||||
|
||||
Choose configuration to test.
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
list-all-presets
|
||||
----------------
|
||||
|
||||
* :option:`cmake --list-presets <cmake --list-presets>` gained
|
||||
``*-defined`` values that list all non-hidden presets of the corresponding
|
||||
type and explain why unavailable presets cannot be used. The ``defined``
|
||||
value is an alias for ``configure-defined``, while ``all-defined`` selects
|
||||
every type. Build, test, and package presets whose configure preset is
|
||||
unavailable are now considered unavailable too.
|
||||
|
||||
* :option:`cmake --workflow --list-presets=defined
|
||||
<cmake--workflow --list-presets>` was added to provide the same
|
||||
availability information for all defined workflow presets and their steps.
|
||||
|
||||
* :option:`cmake --build --list-presets=defined
|
||||
<cmake--build --list-presets>`,
|
||||
:option:`ctest --list-presets=defined <ctest --list-presets>`, and
|
||||
:option:`cpack --list-presets=defined <cpack --list-presets>` were added to
|
||||
list all defined build, test, and package presets, respectively.
|
||||
+32
-9
@@ -62,7 +62,8 @@ cmDocumentationEntry const cmDocumentationOptions[] = {
|
||||
{ "--vendor <vendorName>", "Override/define CPACK_PACKAGE_VENDOR" },
|
||||
{ "--preset", "Read arguments from a package preset" },
|
||||
{ "--presets-file", "Load package presets from the given file" },
|
||||
{ "--list-presets", "List available package presets" }
|
||||
{ "--list-presets[=defined]",
|
||||
"List available or all defined package presets" }
|
||||
};
|
||||
|
||||
void cpackProgressCallback(std::string const& message, float /*unused*/)
|
||||
@@ -209,8 +210,16 @@ int main(int argc, char const* const* argv)
|
||||
CommandArgument{ "--preset", "No preset specified for --preset",
|
||||
CommandArgument::Values::One,
|
||||
CommandArgument::setToValue(presetsArgs.PresetName) },
|
||||
CommandArgument{ "--list-presets", CommandArgument::Values::Zero,
|
||||
CommandArgument::setToTrue(presetsArgs.ListPresets) },
|
||||
CommandArgument{
|
||||
"--list-presets", CommandArgument::Values::ZeroOrOne,
|
||||
[&presetsArgs](std::string const& value, cmake*, cmMakefile*) -> bool {
|
||||
if (presetsArgs.SetListPresets(value)) {
|
||||
return true;
|
||||
}
|
||||
cmSystemTools::Error("Invalid value specified for --list-presets.\n"
|
||||
"The only supported value is \"defined\".");
|
||||
return false;
|
||||
} },
|
||||
CommandArgument{ "--presets-file", "No file specified for --presets-file",
|
||||
CommandArgument::Values::One, presetFileLambda },
|
||||
CommandArgument{ "-D", CommandArgument::Values::One,
|
||||
@@ -269,6 +278,8 @@ int main(int argc, char const* const* argv)
|
||||
gen) != 0;
|
||||
});
|
||||
};
|
||||
auto configureUsabilityCheck =
|
||||
cminst.CreateConfigurePresetUsabilityCheck();
|
||||
|
||||
cmCMakePresetsGraph presetsGraph;
|
||||
auto result = presetsGraph.ReadProjectPresets(workingDirectory,
|
||||
@@ -281,8 +292,10 @@ int main(int argc, char const* const* argv)
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (presetsArgs.ListPresets) {
|
||||
presetsGraph.PrintPackagePresetList(presetGeneratorsPresent);
|
||||
if (presetsArgs.ListPresetsMode) {
|
||||
presetsGraph.PrintPackagePresetList(presetGeneratorsPresent,
|
||||
*presetsArgs.ListPresetsMode,
|
||||
configureUsabilityCheck);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -294,14 +307,20 @@ int main(int argc, char const* const* argv)
|
||||
workingDirectory);
|
||||
if (resolveError) {
|
||||
cmCPack_Log(&log, cmCPackLog::LOG_ERROR, *resolveError << "\n");
|
||||
presetsGraph.PrintPackagePresetList(presetGeneratorsPresent);
|
||||
presetsGraph.PrintPackagePresetList(
|
||||
presetGeneratorsPresent,
|
||||
cmCMakePresetsGraph::PresetListMode::Available,
|
||||
configureUsabilityCheck);
|
||||
return 1;
|
||||
}
|
||||
auto const* expandedPreset = resolveResult.Preset;
|
||||
|
||||
if (!presetGeneratorsPresent(*expandedPreset)) {
|
||||
cmCPack_Log(&log, cmCPackLog::LOG_ERROR, "Cannot use preset");
|
||||
presetsGraph.PrintPackagePresetList(presetGeneratorsPresent);
|
||||
presetsGraph.PrintPackagePresetList(
|
||||
presetGeneratorsPresent,
|
||||
cmCMakePresetsGraph::PresetListMode::Available,
|
||||
configureUsabilityCheck);
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -312,7 +331,9 @@ int main(int argc, char const* const* argv)
|
||||
"No such configure preset in "
|
||||
<< workingDirectory << ": \""
|
||||
<< expandedPreset->ConfigurePreset << "\"\n");
|
||||
presetsGraph.PrintConfigurePresetList();
|
||||
presetsGraph.PrintConfigurePresetList(
|
||||
cmCMakePresetsGraph::PresetListMode::Available,
|
||||
configureUsabilityCheck);
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -321,7 +342,9 @@ int main(int argc, char const* const* argv)
|
||||
"Cannot use hidden configure preset in "
|
||||
<< workingDirectory << ": \""
|
||||
<< expandedPreset->ConfigurePreset << "\"\n");
|
||||
presetsGraph.PrintConfigurePresetList();
|
||||
presetsGraph.PrintConfigurePresetList(
|
||||
cmCMakePresetsGraph::PresetListMode::Available,
|
||||
configureUsabilityCheck);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
@@ -4,14 +4,46 @@
|
||||
|
||||
#include <string>
|
||||
|
||||
#include <cm/optional>
|
||||
|
||||
#include "cmCMakePresetsGraph.h"
|
||||
|
||||
class cmCMakePresetsArgsBase
|
||||
{
|
||||
public:
|
||||
using PresetListMode = cmCMakePresetsGraph::PresetListMode;
|
||||
|
||||
virtual ~cmCMakePresetsArgsBase() = default;
|
||||
|
||||
virtual bool HasPresetsArg() const { return !this->PresetName.empty(); };
|
||||
virtual void Clear() { this->PresetName.clear(); }
|
||||
|
||||
static PresetListMode ParseListPresetsMode(std::string& type)
|
||||
{
|
||||
struct DefinedPresetType
|
||||
{
|
||||
char const* Type;
|
||||
char const* BaseType;
|
||||
};
|
||||
static constexpr DefinedPresetType definedPresetTypes[] = {
|
||||
{ "defined", "" },
|
||||
{ "configure-defined", "configure" },
|
||||
{ "build-defined", "build" },
|
||||
{ "test-defined", "test" },
|
||||
{ "package-defined", "package" },
|
||||
{ "workflow-defined", "workflow" },
|
||||
{ "all-defined", "all" },
|
||||
};
|
||||
|
||||
for (auto const& definedPresetType : definedPresetTypes) {
|
||||
if (type == definedPresetType.Type) {
|
||||
type = definedPresetType.BaseType;
|
||||
return PresetListMode::Defined;
|
||||
}
|
||||
}
|
||||
return PresetListMode::Available;
|
||||
}
|
||||
|
||||
std::string PresetName;
|
||||
std::string PresetsFile;
|
||||
|
||||
@@ -24,16 +56,29 @@ class cmCMakePresetsArgs : public cmCMakePresetsArgsBase
|
||||
public:
|
||||
bool HasPresetsArg() const override
|
||||
{
|
||||
return this->cmCMakePresetsArgsBase::HasPresetsArg() || this->ListPresets;
|
||||
return this->cmCMakePresetsArgsBase::HasPresetsArg() ||
|
||||
this->ListPresetsMode.has_value();
|
||||
}
|
||||
|
||||
void Clear() override
|
||||
{
|
||||
this->cmCMakePresetsArgsBase::Clear();
|
||||
this->ListPresets = false;
|
||||
this->ListPresetsMode.reset();
|
||||
}
|
||||
|
||||
bool ListPresets = false;
|
||||
bool SetListPresets(std::string const& value)
|
||||
{
|
||||
std::string type = value;
|
||||
auto const mode = ParseListPresetsMode(type);
|
||||
if (!type.empty()) {
|
||||
this->Clear();
|
||||
return false;
|
||||
}
|
||||
this->ListPresetsMode = mode;
|
||||
return true;
|
||||
}
|
||||
|
||||
cm::optional<PresetListMode> ListPresetsMode;
|
||||
};
|
||||
|
||||
class cmCMakePresetsConfigureArgs : public cmCMakePresetsArgsBase
|
||||
@@ -60,9 +105,11 @@ public:
|
||||
{
|
||||
this->cmCMakePresetsArgsBase::Clear();
|
||||
this->ListPresets = ListPresetsOption::None;
|
||||
this->ListPresetsMode = PresetListMode::Available;
|
||||
}
|
||||
|
||||
ListPresetsOption ListPresets = ListPresetsOption::None;
|
||||
PresetListMode ListPresetsMode = PresetListMode::Available;
|
||||
};
|
||||
|
||||
class cmCMakePresetsWorkflowArgs : public cmCMakePresetsArgs
|
||||
|
||||
+201
-55
@@ -4,6 +4,7 @@
|
||||
|
||||
#include <algorithm>
|
||||
#include <cassert>
|
||||
#include <cstddef>
|
||||
#include <functional>
|
||||
#include <iomanip>
|
||||
#include <iostream>
|
||||
@@ -527,22 +528,28 @@ ExpandMacroResult VisitEnv(std::string& value, CycleStatus& status,
|
||||
return ExpandMacroResult::Ok;
|
||||
}
|
||||
|
||||
void PrintPresets(
|
||||
std::vector<cmCMakePresetsGraph::Preset const*> const& presets)
|
||||
struct PresetListEntry
|
||||
{
|
||||
cmCMakePresetsGraph::Preset const* Preset;
|
||||
cm::optional<std::string> UnavailableReason;
|
||||
};
|
||||
|
||||
void PrintPresets(std::vector<PresetListEntry> const& presets)
|
||||
{
|
||||
if (presets.empty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
auto presetWithLongestName =
|
||||
std::max_element(presets.begin(), presets.end(),
|
||||
[](cmCMakePresetsGraph::Preset const* a,
|
||||
cmCMakePresetsGraph::Preset const* b) {
|
||||
return a->Name.length() < b->Name.length();
|
||||
});
|
||||
auto longestLength = (*presetWithLongestName)->Name.length();
|
||||
auto presetWithLongestName = std::max_element(
|
||||
presets.begin(), presets.end(),
|
||||
[](PresetListEntry const& a, PresetListEntry const& b) {
|
||||
return a.Preset->Name.length() < b.Preset->Name.length();
|
||||
});
|
||||
auto longestLength = presetWithLongestName->Preset->Name.length();
|
||||
|
||||
for (auto const* preset : presets) {
|
||||
for (auto entryIt = presets.begin(); entryIt != presets.end(); ++entryIt) {
|
||||
auto const& entry = *entryIt;
|
||||
auto const* preset = entry.Preset;
|
||||
std::string name = cmStrCat(" \"", preset->Name, '"');
|
||||
if (!preset->DisplayName.empty()) {
|
||||
int const width = static_cast<int>(longestLength + name.length() -
|
||||
@@ -552,38 +559,106 @@ void PrintPresets(
|
||||
} else {
|
||||
std::cout << name << '\n';
|
||||
}
|
||||
if (entry.UnavailableReason) {
|
||||
std::cout << " Unavailable: " << *entry.UnavailableReason << '\n';
|
||||
if (entryIt + 1 != presets.end()) {
|
||||
std::cout << '\n';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
struct AlwaysTrue
|
||||
template <typename PresetType>
|
||||
cm::optional<std::string> GetUnavailableReason(
|
||||
cmCMakePresetsGraph::PresetPair<PresetType> const& preset)
|
||||
{
|
||||
template <typename T>
|
||||
constexpr bool operator()(T const&) const noexcept
|
||||
{
|
||||
return true;
|
||||
if (preset.Unexpanded.Hidden) {
|
||||
return "hidden";
|
||||
}
|
||||
};
|
||||
if (!preset.Expanded) {
|
||||
// Expansion errors abort preset loading. A missing expanded preset means
|
||||
// expansion was ignored, such as for an unsupported vendor macro.
|
||||
return "unsupported macro expansion";
|
||||
}
|
||||
if (!preset.Expanded->ConditionResult) {
|
||||
auto const& condition = preset.Expanded->ConditionEvaluator;
|
||||
return cmStrCat("condition evaluated to false",
|
||||
!condition || condition->ConditionJson.empty()
|
||||
? ""
|
||||
: cmStrCat(": ", condition->ConditionJson));
|
||||
}
|
||||
return cm::nullopt;
|
||||
}
|
||||
|
||||
template <typename PresetType, typename Filter = AlwaysTrue>
|
||||
template <typename PresetType>
|
||||
cm::optional<std::string> GetUnavailableReason(
|
||||
std::string const& name,
|
||||
std::map<std::string, PresetPair<PresetType>> const& presets)
|
||||
{
|
||||
auto const preset = presets.find(name);
|
||||
if (preset == presets.end()) {
|
||||
return cmStrCat(PresetType::kind(), " preset \"", name,
|
||||
"\" does not exist");
|
||||
}
|
||||
auto reason = GetUnavailableReason(preset->second);
|
||||
if (!reason) {
|
||||
return cm::nullopt;
|
||||
}
|
||||
return cmStrCat(PresetType::kind(), " preset \"", name, "\": ", *reason);
|
||||
}
|
||||
|
||||
cm::optional<std::string> GetUnavailableReason(
|
||||
std::string const& name,
|
||||
std::map<std::string, PresetPair<ConfigurePreset>> const& presets,
|
||||
cmCMakePresetsGraph::ConfigurePresetUsabilityCheck const&
|
||||
additionalUsabilityCheck)
|
||||
{
|
||||
auto const preset = presets.find(name);
|
||||
if (preset == presets.end()) {
|
||||
return cmStrCat("configure preset \"", name, "\" does not exist");
|
||||
}
|
||||
auto reason = GetUnavailableReason(preset->second);
|
||||
if (!reason && additionalUsabilityCheck) {
|
||||
assert(preset->second.Expanded);
|
||||
reason = additionalUsabilityCheck(*preset->second.Expanded);
|
||||
}
|
||||
if (!reason) {
|
||||
return cm::nullopt;
|
||||
}
|
||||
return cmStrCat("configure preset \"", name, "\": ", *reason);
|
||||
}
|
||||
|
||||
template <typename PresetType, typename UsabilityCheck>
|
||||
void PrintPresetList(
|
||||
cmCMakePresetsGraph const* const graph,
|
||||
std::map<std::string, cmCMakePresetsGraph::PresetPair<PresetType>>
|
||||
cmCMakePresetsGraph::*data,
|
||||
std::vector<std::string> cmCMakePresetsGraph::*index, Filter filter = {})
|
||||
std::vector<std::string> cmCMakePresetsGraph::*index,
|
||||
cmCMakePresetsGraph::PresetListMode mode,
|
||||
UsabilityCheck const& additionalUsabilityCheck)
|
||||
{
|
||||
std::vector<cmCMakePresetsGraph::Preset const*> presets;
|
||||
std::vector<PresetListEntry> presets;
|
||||
presets.reserve((graph->*index).size());
|
||||
for (auto const& p : graph->*index) {
|
||||
auto const& preset = (graph->*data).at(p);
|
||||
if (!preset.Unexpanded.Hidden && preset.Expanded &&
|
||||
preset.Expanded->ConditionResult && filter(preset.Unexpanded)) {
|
||||
presets.push_back(
|
||||
static_cast<cmCMakePresetsGraph::Preset const*>(&preset.Unexpanded));
|
||||
for (auto const& name : graph->*index) {
|
||||
auto const& preset = (graph->*data).at(name);
|
||||
if (preset.Unexpanded.Hidden) {
|
||||
continue;
|
||||
}
|
||||
auto reason = GetUnavailableReason(preset);
|
||||
if (!reason) {
|
||||
assert(preset.Expanded);
|
||||
reason = additionalUsabilityCheck(*preset.Expanded);
|
||||
}
|
||||
if (mode == cmCMakePresetsGraph::PresetListMode::Defined || !reason) {
|
||||
presets.push_back({ &preset.Unexpanded, std::move(reason) });
|
||||
}
|
||||
}
|
||||
|
||||
if (!presets.empty()) {
|
||||
std::cout << (gSkipNewLine ? "" : "\n") << "Available "
|
||||
std::cout << (gSkipNewLine ? "" : "\n")
|
||||
<< (mode == cmCMakePresetsGraph::PresetListMode::Defined
|
||||
? "Defined "
|
||||
: "Available ")
|
||||
<< PresetType::kind() << " presets:\n\n";
|
||||
gSkipNewLine = false;
|
||||
PrintPresets(presets);
|
||||
@@ -1472,58 +1547,129 @@ void cmCMakePresetsGraph::ClearPresets()
|
||||
this->Files.clear();
|
||||
}
|
||||
|
||||
void cmCMakePresetsGraph::PrintConfigurePresetList() const
|
||||
{
|
||||
PrintPresetList<ConfigurePreset>(this,
|
||||
&cmCMakePresetsGraph::ConfigurePresets,
|
||||
&cmCMakePresetsGraph::ConfigurePresetOrder);
|
||||
}
|
||||
|
||||
void cmCMakePresetsGraph::PrintConfigurePresetList(
|
||||
std::function<bool(ConfigurePreset const&)> const& filter) const
|
||||
PresetListMode mode,
|
||||
ConfigurePresetUsabilityCheck const& usabilityCheck) const
|
||||
{
|
||||
auto check = [&usabilityCheck](
|
||||
ConfigurePreset const& preset) -> cm::optional<std::string> {
|
||||
if (!usabilityCheck) {
|
||||
return cm::nullopt;
|
||||
}
|
||||
return usabilityCheck(preset);
|
||||
};
|
||||
PrintPresetList<ConfigurePreset>(
|
||||
this, &cmCMakePresetsGraph::ConfigurePresets,
|
||||
&cmCMakePresetsGraph::ConfigurePresetOrder, filter);
|
||||
&cmCMakePresetsGraph::ConfigurePresetOrder, mode, check);
|
||||
}
|
||||
|
||||
void cmCMakePresetsGraph::PrintBuildPresetList() const
|
||||
void cmCMakePresetsGraph::PrintBuildPresetList(
|
||||
PresetListMode mode,
|
||||
ConfigurePresetUsabilityCheck const& configureUsabilityCheck) const
|
||||
{
|
||||
auto usabilityCheck = [this,
|
||||
&configureUsabilityCheck](BuildPreset const& preset) {
|
||||
return GetUnavailableReason(preset.ConfigurePreset, this->ConfigurePresets,
|
||||
configureUsabilityCheck);
|
||||
};
|
||||
PrintPresetList<BuildPreset>(this, &cmCMakePresetsGraph::BuildPresets,
|
||||
&cmCMakePresetsGraph::BuildPresetOrder);
|
||||
&cmCMakePresetsGraph::BuildPresetOrder, mode,
|
||||
usabilityCheck);
|
||||
}
|
||||
|
||||
void cmCMakePresetsGraph::PrintTestPresetList() const
|
||||
void cmCMakePresetsGraph::PrintTestPresetList(
|
||||
PresetListMode mode,
|
||||
ConfigurePresetUsabilityCheck const& configureUsabilityCheck) const
|
||||
{
|
||||
auto usabilityCheck = [this,
|
||||
&configureUsabilityCheck](TestPreset const& preset) {
|
||||
return GetUnavailableReason(preset.ConfigurePreset, this->ConfigurePresets,
|
||||
configureUsabilityCheck);
|
||||
};
|
||||
PrintPresetList<TestPreset>(this, &cmCMakePresetsGraph::TestPresets,
|
||||
&cmCMakePresetsGraph::TestPresetOrder);
|
||||
}
|
||||
|
||||
void cmCMakePresetsGraph::PrintPackagePresetList() const
|
||||
{
|
||||
PrintPresetList<PackagePreset>(this, &cmCMakePresetsGraph::PackagePresets,
|
||||
&cmCMakePresetsGraph::PackagePresetOrder);
|
||||
&cmCMakePresetsGraph::TestPresetOrder, mode,
|
||||
usabilityCheck);
|
||||
}
|
||||
|
||||
void cmCMakePresetsGraph::PrintPackagePresetList(
|
||||
std::function<bool(PackagePreset const&)> const& filter) const
|
||||
PresetListMode mode,
|
||||
ConfigurePresetUsabilityCheck const& configureUsabilityCheck) const
|
||||
{
|
||||
auto usabilityCheck = [this, &configureUsabilityCheck](
|
||||
PackagePreset const& preset) {
|
||||
return GetUnavailableReason(preset.ConfigurePreset, this->ConfigurePresets,
|
||||
configureUsabilityCheck);
|
||||
};
|
||||
PrintPresetList<PackagePreset>(this, &cmCMakePresetsGraph::PackagePresets,
|
||||
&cmCMakePresetsGraph::PackagePresetOrder,
|
||||
filter);
|
||||
mode, usabilityCheck);
|
||||
}
|
||||
|
||||
void cmCMakePresetsGraph::PrintWorkflowPresetList() const
|
||||
void cmCMakePresetsGraph::PrintPackagePresetList(
|
||||
std::function<bool(PackagePreset const&)> const& packageGeneratorsPresent,
|
||||
PresetListMode mode,
|
||||
ConfigurePresetUsabilityCheck const& configureUsabilityCheck) const
|
||||
{
|
||||
auto usabilityCheck = [this, &packageGeneratorsPresent,
|
||||
&configureUsabilityCheck](
|
||||
PackagePreset const& preset) {
|
||||
auto configureReason = GetUnavailableReason(
|
||||
preset.ConfigurePreset, this->ConfigurePresets, configureUsabilityCheck);
|
||||
if (configureReason) {
|
||||
return configureReason;
|
||||
}
|
||||
cm::optional<std::string> generatorReason;
|
||||
if (!packageGeneratorsPresent(preset)) {
|
||||
generatorReason = "one or more package generators are not available";
|
||||
}
|
||||
return generatorReason;
|
||||
};
|
||||
PrintPresetList<PackagePreset>(this, &cmCMakePresetsGraph::PackagePresets,
|
||||
&cmCMakePresetsGraph::PackagePresetOrder,
|
||||
mode, usabilityCheck);
|
||||
}
|
||||
|
||||
void cmCMakePresetsGraph::PrintWorkflowPresetList(
|
||||
PresetListMode mode,
|
||||
ConfigurePresetUsabilityCheck const& configureUsabilityCheck) const
|
||||
{
|
||||
auto usabilityCheck = [this, &configureUsabilityCheck](
|
||||
WorkflowPreset const& preset) {
|
||||
return this->GetWorkflowUnavailableReason(preset, configureUsabilityCheck);
|
||||
};
|
||||
PrintPresetList<WorkflowPreset>(this, &cmCMakePresetsGraph::WorkflowPresets,
|
||||
&cmCMakePresetsGraph::WorkflowPresetOrder);
|
||||
&cmCMakePresetsGraph::WorkflowPresetOrder,
|
||||
mode, usabilityCheck);
|
||||
}
|
||||
|
||||
void cmCMakePresetsGraph::PrintAllPresets() const
|
||||
cm::optional<std::string> cmCMakePresetsGraph::GetWorkflowUnavailableReason(
|
||||
WorkflowPreset const& preset,
|
||||
ConfigurePresetUsabilityCheck const& configureUsabilityCheck) const
|
||||
{
|
||||
this->PrintConfigurePresetList();
|
||||
this->PrintBuildPresetList();
|
||||
this->PrintTestPresetList();
|
||||
this->PrintPackagePresetList();
|
||||
this->PrintWorkflowPresetList();
|
||||
using Type = WorkflowPreset::WorkflowStep::Type;
|
||||
|
||||
std::size_t stepNumber = 0;
|
||||
for (auto const& step : preset.Steps) {
|
||||
++stepNumber;
|
||||
cm::optional<std::string> reason;
|
||||
switch (step.PresetType) {
|
||||
case Type::Configure:
|
||||
reason = GetUnavailableReason(step.PresetName, this->ConfigurePresets,
|
||||
configureUsabilityCheck);
|
||||
break;
|
||||
case Type::Build:
|
||||
reason = GetUnavailableReason(step.PresetName, this->BuildPresets);
|
||||
break;
|
||||
case Type::Test:
|
||||
reason = GetUnavailableReason(step.PresetName, this->TestPresets);
|
||||
break;
|
||||
case Type::Package:
|
||||
reason = GetUnavailableReason(step.PresetName, this->PackagePresets);
|
||||
break;
|
||||
}
|
||||
if (reason) {
|
||||
return cmStrCat("step ", stepNumber, ": ", *reason);
|
||||
}
|
||||
}
|
||||
return cm::nullopt;
|
||||
}
|
||||
|
||||
@@ -24,6 +24,12 @@ enum class PackageResolveMode;
|
||||
class cmCMakePresetsGraph
|
||||
{
|
||||
public:
|
||||
enum class PresetListMode
|
||||
{
|
||||
Available,
|
||||
Defined,
|
||||
};
|
||||
|
||||
std::string errors;
|
||||
cmJSONState parseState;
|
||||
|
||||
@@ -467,16 +473,28 @@ public:
|
||||
|
||||
std::string GetGeneratorForPreset(std::string const& presetName) const;
|
||||
|
||||
void PrintConfigurePresetList() const;
|
||||
using ConfigurePresetUsabilityCheck =
|
||||
std::function<cm::optional<std::string>(ConfigurePreset const&)>;
|
||||
|
||||
void PrintConfigurePresetList(
|
||||
std::function<bool(ConfigurePreset const&)> const& filter) const;
|
||||
void PrintBuildPresetList() const;
|
||||
void PrintTestPresetList() const;
|
||||
void PrintPackagePresetList() const;
|
||||
PresetListMode mode = PresetListMode::Available,
|
||||
ConfigurePresetUsabilityCheck const& usabilityCheck = {}) const;
|
||||
void PrintBuildPresetList(
|
||||
PresetListMode mode = PresetListMode::Available,
|
||||
ConfigurePresetUsabilityCheck const& configureUsabilityCheck = {}) const;
|
||||
void PrintTestPresetList(
|
||||
PresetListMode mode = PresetListMode::Available,
|
||||
ConfigurePresetUsabilityCheck const& configureUsabilityCheck = {}) const;
|
||||
void PrintPackagePresetList(
|
||||
std::function<bool(PackagePreset const&)> const& filter) const;
|
||||
void PrintWorkflowPresetList() const;
|
||||
void PrintAllPresets() const;
|
||||
PresetListMode mode = PresetListMode::Available,
|
||||
ConfigurePresetUsabilityCheck const& configureUsabilityCheck = {}) const;
|
||||
void PrintPackagePresetList(
|
||||
std::function<bool(PackagePreset const&)> const& packageGeneratorsPresent,
|
||||
PresetListMode mode = PresetListMode::Available,
|
||||
ConfigurePresetUsabilityCheck const& configureUsabilityCheck = {}) const;
|
||||
void PrintWorkflowPresetList(
|
||||
PresetListMode mode = PresetListMode::Available,
|
||||
ConfigurePresetUsabilityCheck const& configureUsabilityCheck = {}) const;
|
||||
|
||||
private:
|
||||
enum class RootType
|
||||
@@ -499,6 +517,10 @@ private:
|
||||
File*& file, std::string& errMsg);
|
||||
void ClearPresets();
|
||||
|
||||
cm::optional<std::string> GetWorkflowUnavailableReason(
|
||||
WorkflowPreset const& preset,
|
||||
ConfigurePresetUsabilityCheck const& configureUsabilityCheck) const;
|
||||
|
||||
static std::string GetFilename(std::string const& sourceDir);
|
||||
static std::string GetUserFilename(std::string const& sourceDir);
|
||||
};
|
||||
|
||||
@@ -59,6 +59,8 @@ class cmCMakePresetsGraph::Condition
|
||||
public:
|
||||
virtual ~Condition() = default;
|
||||
|
||||
std::string ConditionJson;
|
||||
|
||||
virtual bool Evaluate(
|
||||
cmCMakePresetsGraphInternal::MacroExpanderVector const& expanders,
|
||||
int version, cm::optional<bool>& out) const = 0;
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
#include <cmext/string_view>
|
||||
|
||||
#include <cm3p/json/value.h>
|
||||
#include <cm3p/json/writer.h>
|
||||
|
||||
#include "cmCMakePresetsErrors.h"
|
||||
#include "cmCMakePresetsGraph.h"
|
||||
@@ -431,6 +432,11 @@ bool PresetConditionHelper(
|
||||
{
|
||||
std::unique_ptr<cmCMakePresetsGraph::Condition> ptr;
|
||||
auto result = ConditionHelper(ptr, value, state);
|
||||
if (result && ptr) {
|
||||
Json::StreamWriterBuilder writer;
|
||||
writer["indentation"] = "";
|
||||
ptr->ConditionJson = Json::writeString(writer, *value);
|
||||
}
|
||||
out = std::move(ptr);
|
||||
return result;
|
||||
}
|
||||
|
||||
+31
-12
@@ -1604,8 +1604,11 @@ bool cmCTest::SetArgsFromPreset(cmCMakePresetsArgs const& args)
|
||||
return false;
|
||||
}
|
||||
|
||||
if (args.ListPresets) {
|
||||
settingsFile.PrintTestPresetList();
|
||||
if (args.ListPresetsMode) {
|
||||
cmake cm(cmState::Role::CTest);
|
||||
auto configureUsabilityCheck = cm.CreateConfigurePresetUsabilityCheck();
|
||||
settingsFile.PrintTestPresetList(*args.ListPresetsMode,
|
||||
configureUsabilityCheck);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1617,7 +1620,10 @@ bool cmCTest::SetArgsFromPreset(cmCMakePresetsArgs const& args)
|
||||
workingDirectory);
|
||||
if (resolveError) {
|
||||
cmSystemTools::Error(*resolveError);
|
||||
settingsFile.PrintTestPresetList();
|
||||
cmake cm(cmState::Role::CTest);
|
||||
auto configureUsabilityCheck = cm.CreateConfigurePresetUsabilityCheck();
|
||||
settingsFile.PrintTestPresetList(
|
||||
cmCMakePresetsGraph::PresetListMode::Available, configureUsabilityCheck);
|
||||
return false;
|
||||
}
|
||||
auto const* expandedPreset = resolveResult.Preset;
|
||||
@@ -1628,7 +1634,10 @@ bool cmCTest::SetArgsFromPreset(cmCMakePresetsArgs const& args)
|
||||
cmSystemTools::Error(cmStrCat("No such configure preset in ",
|
||||
workingDirectory, ": \"",
|
||||
expandedPreset->ConfigurePreset, '"'));
|
||||
settingsFile.PrintConfigurePresetList();
|
||||
cmake cm(cmState::Role::CTest);
|
||||
auto configureUsabilityCheck = cm.CreateConfigurePresetUsabilityCheck();
|
||||
settingsFile.PrintConfigurePresetList(
|
||||
cmCMakePresetsGraph::PresetListMode::Available, configureUsabilityCheck);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1636,7 +1645,10 @@ bool cmCTest::SetArgsFromPreset(cmCMakePresetsArgs const& args)
|
||||
cmSystemTools::Error(cmStrCat("Cannot use hidden configure preset in ",
|
||||
workingDirectory, ": \"",
|
||||
expandedPreset->ConfigurePreset, '"'));
|
||||
settingsFile.PrintConfigurePresetList();
|
||||
cmake cm(cmState::Role::CTest);
|
||||
auto configureUsabilityCheck = cm.CreateConfigurePresetUsabilityCheck();
|
||||
settingsFile.PrintConfigurePresetList(
|
||||
cmCMakePresetsGraph::PresetListMode::Available, configureUsabilityCheck);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -2005,10 +2017,15 @@ int cmCTest::Run(std::vector<std::string> const& args)
|
||||
cmCommandLineArgument<bool(std::string const& value)>;
|
||||
|
||||
auto const presetArguments = std::vector<CommandArgument>{
|
||||
CommandArgument{ "--list-presets", CommandArgument::Values::Zero,
|
||||
[&presetsArgs](std::string const&) -> bool {
|
||||
presetsArgs.ListPresets = true;
|
||||
return true;
|
||||
CommandArgument{ "--list-presets", CommandArgument::Values::ZeroOrOne,
|
||||
[&presetsArgs](std::string const& value) -> bool {
|
||||
if (presetsArgs.SetListPresets(value)) {
|
||||
return true;
|
||||
}
|
||||
cmSystemTools::Error(
|
||||
"Invalid value specified for --list-presets.\n"
|
||||
"The only supported value is \"defined\".");
|
||||
return false;
|
||||
} },
|
||||
CommandArgument{ "--preset", "'--preset' requires an argument",
|
||||
CommandArgument::Values::One,
|
||||
@@ -2024,8 +2041,10 @@ int cmCTest::Run(std::vector<std::string> const& args)
|
||||
return true;
|
||||
} }
|
||||
};
|
||||
auto const isPresetArgument = [&](std::string const& arg) -> bool {
|
||||
return cmHasLiteralPrefix(arg, "--preset") || arg == "--list-presets";
|
||||
auto const isPresetArgument = [&presetArguments](std::string const& arg) {
|
||||
return std::any_of(
|
||||
presetArguments.begin(), presetArguments.end(),
|
||||
[&arg](CommandArgument const& option) { return option.matches(arg); });
|
||||
};
|
||||
|
||||
auto const arguments = std::vector<CommandArgument>{
|
||||
@@ -2539,7 +2558,7 @@ int cmCTest::Run(std::vector<std::string> const& args)
|
||||
|
||||
if (presetsArgs.HasPresetsArg()) {
|
||||
bool success = this->SetArgsFromPreset(presetsArgs);
|
||||
if (presetsArgs.ListPresets) {
|
||||
if (presetsArgs.ListPresetsMode) {
|
||||
return static_cast<int>(!success);
|
||||
}
|
||||
if (!success) {
|
||||
|
||||
+65
-31
@@ -1461,26 +1461,31 @@ void cmake::SetArgs(std::vector<std::string> const& args)
|
||||
arguments.emplace_back(
|
||||
"--list-presets", CommandArgument::Values::ZeroOrOne,
|
||||
[&](std::string const& value, cmake*) -> bool {
|
||||
if (value.empty() || value == "configure") {
|
||||
std::string type = value;
|
||||
auto const mode = presetsArgs.ParseListPresetsMode(type);
|
||||
|
||||
if (type.empty() || type == "configure") {
|
||||
presetsArgs.ListPresets = ListPresets::Configure;
|
||||
} else if (value == "build") {
|
||||
} else if (type == "build") {
|
||||
presetsArgs.ListPresets = ListPresets::Build;
|
||||
} else if (value == "test") {
|
||||
} else if (type == "test") {
|
||||
presetsArgs.ListPresets = ListPresets::Test;
|
||||
} else if (value == "package") {
|
||||
} else if (type == "package") {
|
||||
presetsArgs.ListPresets = ListPresets::Package;
|
||||
} else if (value == "workflow") {
|
||||
} else if (type == "workflow") {
|
||||
presetsArgs.ListPresets = ListPresets::Workflow;
|
||||
} else if (value == "all") {
|
||||
} else if (type == "all") {
|
||||
presetsArgs.ListPresets = ListPresets::All;
|
||||
} else {
|
||||
cmSystemTools::Error(
|
||||
"Invalid value specified for --list-presets.\n"
|
||||
"Valid values are configure, build, test, package, or all. "
|
||||
"When no value is passed the default is configure.");
|
||||
"Valid values are configure, build, test, package, workflow, all, "
|
||||
"defined, or any of the type values suffixed with -defined. When "
|
||||
"no value is passed the default is configure.");
|
||||
return false;
|
||||
}
|
||||
|
||||
presetsArgs.ListPresetsMode = mode;
|
||||
return true;
|
||||
});
|
||||
|
||||
@@ -2057,24 +2062,39 @@ bool cmake::SetArgsFromPreset(cmCMakePresetsConfigureArgs const& args,
|
||||
}
|
||||
|
||||
if (args.ListPresets != ListPresets::None) {
|
||||
auto configureUsabilityCheck = this->CreateConfigurePresetUsabilityCheck();
|
||||
switch (args.ListPresets) {
|
||||
case ListPresets::Configure:
|
||||
this->PrintPresetList(presetsGraph);
|
||||
presetsGraph.PrintConfigurePresetList(args.ListPresetsMode,
|
||||
configureUsabilityCheck);
|
||||
break;
|
||||
case ListPresets::Build:
|
||||
presetsGraph.PrintBuildPresetList();
|
||||
presetsGraph.PrintBuildPresetList(args.ListPresetsMode,
|
||||
configureUsabilityCheck);
|
||||
break;
|
||||
case ListPresets::Test:
|
||||
presetsGraph.PrintTestPresetList();
|
||||
presetsGraph.PrintTestPresetList(args.ListPresetsMode,
|
||||
configureUsabilityCheck);
|
||||
break;
|
||||
case ListPresets::Package:
|
||||
presetsGraph.PrintPackagePresetList();
|
||||
presetsGraph.PrintPackagePresetList(args.ListPresetsMode,
|
||||
configureUsabilityCheck);
|
||||
break;
|
||||
case ListPresets::Workflow:
|
||||
presetsGraph.PrintWorkflowPresetList();
|
||||
presetsGraph.PrintWorkflowPresetList(args.ListPresetsMode,
|
||||
configureUsabilityCheck);
|
||||
break;
|
||||
case ListPresets::All:
|
||||
presetsGraph.PrintAllPresets();
|
||||
presetsGraph.PrintConfigurePresetList(args.ListPresetsMode,
|
||||
configureUsabilityCheck);
|
||||
presetsGraph.PrintBuildPresetList(args.ListPresetsMode,
|
||||
configureUsabilityCheck);
|
||||
presetsGraph.PrintTestPresetList(args.ListPresetsMode,
|
||||
configureUsabilityCheck);
|
||||
presetsGraph.PrintPackagePresetList(args.ListPresetsMode,
|
||||
configureUsabilityCheck);
|
||||
presetsGraph.PrintWorkflowPresetList(args.ListPresetsMode,
|
||||
configureUsabilityCheck);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@@ -2192,23 +2212,32 @@ bool cmake::SetArgsFromPreset(cmCMakePresetsConfigureArgs const& args,
|
||||
return true;
|
||||
}
|
||||
|
||||
void cmake::PrintPresetList(cmCMakePresetsGraph const& graph) const
|
||||
cmCMakePresetsGraph::ConfigurePresetUsabilityCheck
|
||||
cmake::CreateConfigurePresetUsabilityCheck() const
|
||||
{
|
||||
std::vector<GeneratorInfo> generators;
|
||||
this->GetRegisteredGenerators(generators);
|
||||
auto filter =
|
||||
[&generators](cmCMakePresetsGraph::ConfigurePreset const& preset) -> bool {
|
||||
if (preset.Generator.empty()) {
|
||||
return true;
|
||||
}
|
||||
auto condition = [&preset](GeneratorInfo const& info) -> bool {
|
||||
return info.name == preset.Generator;
|
||||
};
|
||||
auto it = std::find_if(generators.begin(), generators.end(), condition);
|
||||
return it != generators.end();
|
||||
};
|
||||
|
||||
graph.PrintConfigurePresetList(filter);
|
||||
std::set<std::string> generatorNames;
|
||||
for (auto const& generator : generators) {
|
||||
generatorNames.insert(generator.name);
|
||||
}
|
||||
|
||||
return [generatorNames](cmCMakePresetsGraph::ConfigurePreset const& preset)
|
||||
-> cm::optional<std::string> {
|
||||
if (preset.Generator.empty() ||
|
||||
generatorNames.count(preset.Generator) != 0) {
|
||||
return cm::nullopt;
|
||||
}
|
||||
return cmStrCat("generator \"", preset.Generator, "\" is not available");
|
||||
};
|
||||
}
|
||||
|
||||
void cmake::PrintPresetList(cmCMakePresetsGraph const& graph,
|
||||
cmCMakePresetsGraph::PresetListMode mode) const
|
||||
{
|
||||
graph.PrintConfigurePresetList(mode,
|
||||
this->CreateConfigurePresetUsabilityCheck());
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -3926,8 +3955,11 @@ int cmake::Build(cmBuildArgs buildArgs, std::vector<std::string> targets,
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (presetsArgs.ListPresets) {
|
||||
settingsFile.PrintBuildPresetList();
|
||||
if (presetsArgs.ListPresetsMode) {
|
||||
auto configureUsabilityCheck =
|
||||
this->CreateConfigurePresetUsabilityCheck();
|
||||
settingsFile.PrintBuildPresetList(*presetsArgs.ListPresetsMode,
|
||||
configureUsabilityCheck);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -4310,8 +4342,10 @@ int cmake::Workflow(cmCMakePresetsWorkflowArgs const& args)
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (args.ListPresets) {
|
||||
settingsFile.PrintWorkflowPresetList();
|
||||
if (args.ListPresetsMode) {
|
||||
auto configureUsabilityCheck = this->CreateConfigurePresetUsabilityCheck();
|
||||
settingsFile.PrintWorkflowPresetList(*args.ListPresetsMode,
|
||||
configureUsabilityCheck);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
+6
-1
@@ -261,7 +261,12 @@ public:
|
||||
bool SetArgsFromPreset(cmCMakePresetsConfigureArgs const& args,
|
||||
bool haveBinaryDirArg);
|
||||
|
||||
void PrintPresetList(cmCMakePresetsGraph const& graph) const;
|
||||
cmCMakePresetsGraph::ConfigurePresetUsabilityCheck
|
||||
CreateConfigurePresetUsabilityCheck() const;
|
||||
|
||||
void PrintPresetList(cmCMakePresetsGraph const& graph,
|
||||
cmCMakePresetsGraph::PresetListMode mode =
|
||||
cmCMakePresetsGraph::PresetListMode::Available) const;
|
||||
#endif
|
||||
|
||||
//! Return the global generator assigned to this instance of cmake
|
||||
|
||||
+29
-11
@@ -533,8 +533,16 @@ int do_build(int ac, char const* const* av)
|
||||
CommandArgument::setToValue(presetsArgs.PresetName) },
|
||||
CommandArgument{ "--presets-file", "No file specified for --presets-file",
|
||||
CommandArgument::Values::One, presetFileLambda },
|
||||
CommandArgument{ "--list-presets", CommandArgument::Values::Zero,
|
||||
CommandArgument::setToTrue(presetsArgs.ListPresets) },
|
||||
CommandArgument{ "--list-presets", CommandArgument::Values::ZeroOrOne,
|
||||
[&presetsArgs](std::string const& value) -> bool {
|
||||
if (presetsArgs.SetListPresets(value)) {
|
||||
return true;
|
||||
}
|
||||
cmSystemTools::Error(
|
||||
"Invalid value specified for --list-presets.\n"
|
||||
"The only supported value is \"defined\".");
|
||||
return false;
|
||||
} },
|
||||
CommandArgument{ "-j", CommandArgument::Values::ZeroOrOne,
|
||||
CommandArgument::RequiresSeparator::No, jLambda },
|
||||
CommandArgument{ "--parallel", CommandArgument::Values::ZeroOrOne,
|
||||
@@ -644,8 +652,8 @@ int do_build(int ac, char const* const* av)
|
||||
" = Specify a build preset.\n"
|
||||
" --presets-file <file>, --presets-file=<file>\n"
|
||||
" = Specify the path to a presets file.\n"
|
||||
" --list-presets[=<type>]\n"
|
||||
" = List available build presets.\n"
|
||||
" --list-presets[=defined]\n"
|
||||
" = List available or all defined build presets.\n"
|
||||
" --parallel [<jobs>], -j [<jobs>]\n"
|
||||
" = Build in parallel using the given number of jobs. \n"
|
||||
" If <jobs> is omitted the native build tool's \n"
|
||||
@@ -1046,8 +1054,17 @@ int do_workflow(int ac, char const* const* av)
|
||||
cmSystemTools::ToNormalizedPathOnDisk(value);
|
||||
return true;
|
||||
} },
|
||||
CommandArgument{ "--list-presets", CommandArgument::Values::Zero,
|
||||
CommandArgument::setToTrue(presetsArgs.ListPresets) },
|
||||
CommandArgument{ "--list-presets", CommandArgument::Values::ZeroOrOne,
|
||||
[&presetsArgs](std::string const& value) -> bool {
|
||||
if (presetsArgs.SetListPresets(value)) {
|
||||
return true;
|
||||
}
|
||||
std::cerr
|
||||
<< "Invalid value specified for --list-presets.\n"
|
||||
"The only supported value in workflow mode is "
|
||||
"\"defined\".\n";
|
||||
return false;
|
||||
} },
|
||||
CommandArgument{ "--fresh", CommandArgument::Values::Zero,
|
||||
CommandArgument::setToTrue(presetsArgs.Fresh) }
|
||||
};
|
||||
@@ -1088,11 +1105,12 @@ int do_workflow(int ac, char const* const* av)
|
||||
std::cerr <<
|
||||
"Usage: cmake --workflow <options>\n"
|
||||
"Options:\n"
|
||||
" --preset <preset> = Workflow preset to execute.\n"
|
||||
" --presets-file <file> = Path to a presets file.\n"
|
||||
" --list-presets = List available workflow presets.\n"
|
||||
" --fresh = Configure a fresh build tree, removing any "
|
||||
"existing cache file.\n"
|
||||
" --preset <preset> = Workflow preset to execute.\n"
|
||||
" --presets-file <file> = Path to a presets file.\n"
|
||||
" --list-presets[=defined] = List available or all defined workflow "
|
||||
"presets.\n"
|
||||
" --fresh = Configure a fresh build tree, removing "
|
||||
"any existing cache file.\n"
|
||||
;
|
||||
/* clang-format on */
|
||||
return 1;
|
||||
|
||||
+2
-1
@@ -31,7 +31,8 @@ cmDocumentationEntry const cmDocumentationOptions[] = {
|
||||
"Read arguments from a test preset." },
|
||||
{ "--presets-file <file>, --presets-file=<file>",
|
||||
"Load test presets from the given file." },
|
||||
{ "--list-presets", "List available test presets." },
|
||||
{ "--list-presets[=defined]",
|
||||
"List available or all defined test presets." },
|
||||
{ "-C <cfg>, --build-config <cfg>", "Choose configuration to test." },
|
||||
{ "--progress", "Enable short progress output from tests." },
|
||||
{ "-V,--verbose", "Enable verbose output from tests." },
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
^CMake Error: Unknown argument -defined
|
||||
CMake Error: Run 'cmake --help' for all supported options\.$
|
||||
@@ -1,3 +1,3 @@
|
||||
^CMake Error: Invalid value specified for --list-presets\.
|
||||
Valid values are configure, build, test, package, or all\. When no value is passed the default is configure\.
|
||||
Valid values are configure, build, test, package, workflow, all, defined, or any of the type values suffixed with -defined. When no value is passed the default is configure\.
|
||||
CMake Error: Run 'cmake --help' for all supported options\.$
|
||||
|
||||
@@ -395,6 +395,13 @@ unset(CMakePresets_FILE_ARG_EXTRA_FILES)
|
||||
set(CMakePresets_FILE "${RunCMake_SOURCE_DIR}/ListPresets.json.in")
|
||||
run_cmake_presets(ListPresets --list-presets)
|
||||
run_cmake_presets(ListPresetsInvalidType --list-presets=invalid-type)
|
||||
set(RunCMake_TEST_EXPECT_RESULT 1)
|
||||
run_cmake_presets(ListPresetsInvalidDefinedPrefix --list-presets=-defined)
|
||||
set(RunCMake-stderr-file ListPresetsInvalidType-stderr.txt)
|
||||
run_cmake_presets(ListPresetsInvalidRepeatedDefined
|
||||
--list-presets=configure-defined-defined)
|
||||
unset(RunCMake_TEST_EXPECT_RESULT)
|
||||
unset(RunCMake-stderr-file)
|
||||
|
||||
set(RunCMake_TEST_BINARY_DIR "${RunCMake_BINARY_DIR}/ListPresetsWorkingDir")
|
||||
set(RunCMake_TEST_NO_CLEAN 1)
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
^Defined build presets:
|
||||
|
||||
"build-default" +- build-default displayName
|
||||
"empty"
|
||||
"display" +- display displayName
|
||||
"true"
|
||||
"false" +- false displayName
|
||||
Unavailable: condition evaluated to false: false$
|
||||
@@ -0,0 +1,6 @@
|
||||
^Available build presets:
|
||||
|
||||
"build-default" +- build-default displayName
|
||||
"empty"
|
||||
"display" +- display displayName
|
||||
"true"$
|
||||
@@ -35,6 +35,7 @@
|
||||
{
|
||||
"name": "false",
|
||||
"inherits": "build-default",
|
||||
"displayName": "false displayName",
|
||||
"condition": false
|
||||
}
|
||||
]
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
1
|
||||
@@ -0,0 +1,29 @@
|
||||
^CMake Error: Invalid value specified for --list-presets\.
|
||||
The only supported value is "defined"\.
|
||||
Usage: cmake --build <dir> \[options\] \[-- \[native-options\]\]
|
||||
cmake --build --preset <preset> \[options\] \[-- \[native-options\]\]
|
||||
Options:
|
||||
<dir> = Project binary directory to be built\.
|
||||
--preset <preset>, --preset=<preset>
|
||||
= Specify a build preset\.
|
||||
--presets-file <file>, --presets-file=<file>
|
||||
= Specify the path to a presets file\.
|
||||
--list-presets\[=defined\]
|
||||
= List available or all defined build presets\.
|
||||
--parallel \[<jobs>\], -j \[<jobs>\]
|
||||
= Build in parallel using the given number of jobs\.[ ]*
|
||||
If <jobs> is omitted the native build tool's[ ]*
|
||||
default number is used\.
|
||||
The CMAKE_BUILD_PARALLEL_LEVEL environment variable
|
||||
specifies a default parallel level when this option
|
||||
is not given\.
|
||||
-t <tgt>\.\.\., --target <tgt>\.\.\.
|
||||
= Build <tgt> instead of default targets\.
|
||||
--config <cfg> = For multi-configuration tools, choose <cfg>\.
|
||||
--clean-first = Build target 'clean' first, then build\.
|
||||
\(To clean only, use --target 'clean'\.\)
|
||||
--resolve-package-references=\{on\|only\|off\}
|
||||
= Restore/resolve package references during build\.
|
||||
-v, --verbose = Enable verbose output - if supported - including
|
||||
the build commands to be executed\.[ ]*
|
||||
-- = Pass remaining options to the native tool\.$
|
||||
@@ -91,6 +91,8 @@ set(CMakePresetsBuild_BUILD_ONLY 1)
|
||||
run_cmake_command(PresetsNoArg-build ${CMAKE_COMMAND} "--build" "--preset")
|
||||
run_cmake_command(PresetsNoArgEq-build ${CMAKE_COMMAND} "--build" "--preset=")
|
||||
run_cmake_Command(PresetsFileNoArg-build ${CMAKE_COMMAND} "--build" "--presets-file")
|
||||
run_cmake_command(ListPresetsInvalidValue-build
|
||||
${CMAKE_COMMAND} "--build" "--list-presets=invalid")
|
||||
run_cmake_build_presets(ListPresets "x" "x" "--list-presets" "")
|
||||
run_cmake_build_presets(NoConfigurePreset "x" "noConfigurePreset" "")
|
||||
run_cmake_build_presets(Invalid "x" "hidden;vendorMacro" "")
|
||||
@@ -128,6 +130,15 @@ block()
|
||||
run_cmake_command("${name}-configure"
|
||||
"${CMAKE_COMMAND}" "--preset" "default")
|
||||
|
||||
# Verify listing presets using a build directory to infer the presets file
|
||||
# from its CMake cache.
|
||||
run_cmake_command("${name}-list"
|
||||
"${CMAKE_COMMAND}" "--build" "${RunCMake_TEST_BINARY_DIR}"
|
||||
"--list-presets")
|
||||
run_cmake_command("${name}-list-defined"
|
||||
"${CMAKE_COMMAND}" "--build" "${RunCMake_TEST_BINARY_DIR}"
|
||||
"--list-presets=defined")
|
||||
|
||||
# Verify calling `cmake --build <dir> --preset <pre>` from the
|
||||
# binary directory.
|
||||
set(RunCMake_TEST_COMMAND_WORKING_DIRECTORY "${RunCMake_TEST_BINARY_DIR}")
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
^Defined package presets:
|
||||
|
||||
"default"
|
||||
"with-description" +- With Description
|
||||
"unavailable-generator"
|
||||
Unavailable: one or more package generators are not available$
|
||||
@@ -16,6 +16,11 @@
|
||||
"displayName": "With Description",
|
||||
"description": "This preset has a description",
|
||||
"configurePreset": "default"
|
||||
},
|
||||
{
|
||||
"name": "unavailable-generator",
|
||||
"configurePreset": "default",
|
||||
"generators": ["Invalid Generator"]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@@ -106,6 +106,9 @@ endfunction()
|
||||
run_cmake_package_presets(UnsupportedVersion "x" "" "")
|
||||
run_cmake_package_presets(Good "default" "build-default-debug" "no-environment;with-environment;generators;configurations;variables;config-file;debug;verbose;package-name;package-version;package-directory;vendor-name")
|
||||
run_cmake_package_presets(ListPresets "default" "" "x" "--list-presets")
|
||||
set(CMakePresetsPackage_FILE "${RunCMake_SOURCE_DIR}/ListPresets.json.in")
|
||||
run_cmake_package_presets(ListDefinedPresets "" "" "x" "--list-presets=defined")
|
||||
unset(CMakePresetsPackage_FILE)
|
||||
|
||||
set(CMakePresets_FILE_ARG "OtherCMakePresetsFile.json")
|
||||
run_cmake_package_presets(OtherCMakePresetsFile "default" "default" "default-from-other-file" "")
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
1
|
||||
@@ -0,0 +1,2 @@
|
||||
^CMake Error: Unknown argument: --preset-invalid
|
||||
CMake Error: Run 'ctest --help' for all supported options\.$
|
||||
@@ -104,6 +104,8 @@ run_cmake_test_presets(ListPresets "" "" "x" "--list-presets")
|
||||
run_cmake_command(PresetsNoArg-test ${CMAKE_CTEST_COMMAND} "--preset")
|
||||
run_cmake_command(PresetsNoArgEq-test ${CMAKE_CTEST_COMMAND} "--preset=")
|
||||
run_cmake_command(PresetsFileNoArg-test ${CMAKE_CTEST_COMMAND} "--presets-file")
|
||||
run_cmake_command(PresetsInvalidOptionPrefix-test
|
||||
${CMAKE_CTEST_COMMAND} "--preset-invalid")
|
||||
|
||||
set(CMakePresetsTest_FILE "${RunCMake_SOURCE_DIR}/Condition.json.in")
|
||||
run_cmake_test_presets(ConditionListPresets "" "" "x" "--list-presets")
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
^Unknown argument -DINVALID_OPTION
|
||||
Usage: cmake --workflow <options>
|
||||
Options:
|
||||
--preset <preset> = Workflow preset to execute\.
|
||||
--presets-file <file> = Path to a presets file\.
|
||||
--list-presets = List available workflow presets\.
|
||||
--fresh = Configure a fresh build tree, removing any existing cache file\.$
|
||||
--preset <preset> = Workflow preset to execute\.
|
||||
--presets-file <file> = Path to a presets file\.
|
||||
--list-presets\[=defined\] = List available or all defined workflow presets\.
|
||||
--fresh = Configure a fresh build tree, removing any existing cache file\.$
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
^Available configure presets:
|
||||
|
||||
"default"
|
||||
|
||||
Available build presets:
|
||||
|
||||
"default"
|
||||
"enabled-build"
|
||||
|
||||
Available test presets:
|
||||
|
||||
"default"
|
||||
"enabled-test"
|
||||
|
||||
Available package presets:
|
||||
|
||||
"default"
|
||||
"enabled-package"
|
||||
|
||||
Available workflow presets:
|
||||
|
||||
"default"
|
||||
"with-description" +- With Description
|
||||
"enabled-dependent-steps"$
|
||||
@@ -0,0 +1,29 @@
|
||||
^Available configure presets:
|
||||
|
||||
"default"
|
||||
"disabled-expression"
|
||||
|
||||
Available build presets:
|
||||
|
||||
"default"
|
||||
"enabled-build"
|
||||
"disabled-configure-build"
|
||||
|
||||
Available test presets:
|
||||
|
||||
"default"
|
||||
"enabled-test"
|
||||
"disabled-configure-test"
|
||||
|
||||
Available package presets:
|
||||
|
||||
"default"
|
||||
"enabled-package"
|
||||
"disabled-configure-package"
|
||||
|
||||
Available workflow presets:
|
||||
|
||||
"default"
|
||||
"with-description" +- With Description
|
||||
"enabled-dependent-steps"
|
||||
"disabled-expression-step"$
|
||||
@@ -0,0 +1,5 @@
|
||||
^Available workflow presets:
|
||||
|
||||
"default"
|
||||
"with-description" +- With Description
|
||||
"enabled-dependent-steps"$
|
||||
@@ -0,0 +1,4 @@
|
||||
^Available build presets:
|
||||
|
||||
"default"
|
||||
"enabled-build"$
|
||||
@@ -0,0 +1,4 @@
|
||||
^Available build presets:
|
||||
|
||||
"default"
|
||||
"enabled-build"$
|
||||
@@ -0,0 +1,24 @@
|
||||
^Defined build presets:
|
||||
|
||||
"default"
|
||||
"enabled-build"
|
||||
"disabled-build"
|
||||
Unavailable: condition evaluated to false: false
|
||||
|
||||
"disabled-configure-build"
|
||||
Unavailable: configure preset "disabled-expression": condition evaluated to false: .*CMAKE_PRESET_TEST_UNFULFILLED_ENV.*
|
||||
|
||||
"disabled-build-and-configure"
|
||||
Unavailable: condition evaluated to false: false
|
||||
|
||||
"invalid-build"
|
||||
Unavailable: unsupported macro expansion
|
||||
|
||||
"hidden-configure-build"
|
||||
Unavailable: configure preset "hidden": hidden
|
||||
|
||||
"invalid-configure-build"
|
||||
Unavailable: configure preset "invalid": unsupported macro expansion
|
||||
|
||||
"unsupported-configure-build"
|
||||
Unavailable: configure preset "unsupported-generator": generator "Invalid Generator" is not available$
|
||||
@@ -0,0 +1,14 @@
|
||||
^Defined configure presets:
|
||||
|
||||
"default"
|
||||
"disabled" +- Disabled Configure
|
||||
Unavailable: condition evaluated to false: false
|
||||
|
||||
"disabled-expression"
|
||||
Unavailable: condition evaluated to false: .*CMAKE_PRESET_TEST_UNFULFILLED_ENV.*
|
||||
|
||||
"invalid"
|
||||
Unavailable: unsupported macro expansion
|
||||
|
||||
"unsupported-generator"
|
||||
Unavailable: generator "Invalid Generator" is not available$
|
||||
@@ -0,0 +1,24 @@
|
||||
^Defined package presets:
|
||||
|
||||
"default"
|
||||
"enabled-package"
|
||||
"disabled-package"
|
||||
Unavailable: condition evaluated to false: false
|
||||
|
||||
"disabled-configure-package"
|
||||
Unavailable: configure preset "disabled-expression": condition evaluated to false: .*CMAKE_PRESET_TEST_UNFULFILLED_ENV.*
|
||||
|
||||
"disabled-package-and-configure"
|
||||
Unavailable: condition evaluated to false: false
|
||||
|
||||
"invalid-package"
|
||||
Unavailable: unsupported macro expansion
|
||||
|
||||
"hidden-configure-package"
|
||||
Unavailable: configure preset "hidden": hidden
|
||||
|
||||
"invalid-configure-package"
|
||||
Unavailable: configure preset "invalid": unsupported macro expansion
|
||||
|
||||
"unsupported-configure-package"
|
||||
Unavailable: configure preset "unsupported-generator": generator "Invalid Generator" is not available$
|
||||
@@ -0,0 +1,136 @@
|
||||
^Defined configure presets:
|
||||
|
||||
"default"
|
||||
"disabled" +- Disabled Configure
|
||||
Unavailable: condition evaluated to false: false
|
||||
|
||||
"disabled-expression"
|
||||
Unavailable: condition evaluated to false: .*CMAKE_PRESET_TEST_UNFULFILLED_ENV.*
|
||||
|
||||
"invalid"
|
||||
Unavailable: unsupported macro expansion
|
||||
|
||||
"unsupported-generator"
|
||||
Unavailable: generator "Invalid Generator" is not available
|
||||
|
||||
Defined build presets:
|
||||
|
||||
"default"
|
||||
"enabled-build"
|
||||
"disabled-build"
|
||||
Unavailable: condition evaluated to false: false
|
||||
|
||||
"disabled-configure-build"
|
||||
Unavailable: configure preset "disabled-expression": condition evaluated to false: .*CMAKE_PRESET_TEST_UNFULFILLED_ENV.*
|
||||
|
||||
"disabled-build-and-configure"
|
||||
Unavailable: condition evaluated to false: false
|
||||
|
||||
"invalid-build"
|
||||
Unavailable: unsupported macro expansion
|
||||
|
||||
"hidden-configure-build"
|
||||
Unavailable: configure preset "hidden": hidden
|
||||
|
||||
"invalid-configure-build"
|
||||
Unavailable: configure preset "invalid": unsupported macro expansion
|
||||
|
||||
"unsupported-configure-build"
|
||||
Unavailable: configure preset "unsupported-generator": generator "Invalid Generator" is not available
|
||||
|
||||
Defined test presets:
|
||||
|
||||
"default"
|
||||
"enabled-test"
|
||||
"disabled-test"
|
||||
Unavailable: condition evaluated to false: false
|
||||
|
||||
"disabled-configure-test"
|
||||
Unavailable: configure preset "disabled-expression": condition evaluated to false: .*CMAKE_PRESET_TEST_UNFULFILLED_ENV.*
|
||||
|
||||
"disabled-test-and-configure"
|
||||
Unavailable: condition evaluated to false: false
|
||||
|
||||
"invalid-test"
|
||||
Unavailable: unsupported macro expansion
|
||||
|
||||
"hidden-configure-test"
|
||||
Unavailable: configure preset "hidden": hidden
|
||||
|
||||
"invalid-configure-test"
|
||||
Unavailable: configure preset "invalid": unsupported macro expansion
|
||||
|
||||
"unsupported-configure-test"
|
||||
Unavailable: configure preset "unsupported-generator": generator "Invalid Generator" is not available
|
||||
|
||||
Defined package presets:
|
||||
|
||||
"default"
|
||||
"enabled-package"
|
||||
"disabled-package"
|
||||
Unavailable: condition evaluated to false: false
|
||||
|
||||
"disabled-configure-package"
|
||||
Unavailable: configure preset "disabled-expression": condition evaluated to false: .*CMAKE_PRESET_TEST_UNFULFILLED_ENV.*
|
||||
|
||||
"disabled-package-and-configure"
|
||||
Unavailable: condition evaluated to false: false
|
||||
|
||||
"invalid-package"
|
||||
Unavailable: unsupported macro expansion
|
||||
|
||||
"hidden-configure-package"
|
||||
Unavailable: configure preset "hidden": hidden
|
||||
|
||||
"invalid-configure-package"
|
||||
Unavailable: configure preset "invalid": unsupported macro expansion
|
||||
|
||||
"unsupported-configure-package"
|
||||
Unavailable: configure preset "unsupported-generator": generator "Invalid Generator" is not available
|
||||
|
||||
Defined workflow presets:
|
||||
|
||||
"default"
|
||||
"with-description" +- With Description
|
||||
"enabled-dependent-steps"
|
||||
"disabled-step"
|
||||
Unavailable: step 1: configure preset "disabled": condition evaluated to false: false
|
||||
|
||||
"disabled-expression-step"
|
||||
Unavailable: step 1: configure preset "disabled-expression": condition evaluated to false: .*CMAKE_PRESET_TEST_UNFULFILLED_ENV.*
|
||||
|
||||
"disabled-build-step"
|
||||
Unavailable: step 2: build preset "disabled-build": condition evaluated to false: false
|
||||
|
||||
"disabled-test-step"
|
||||
Unavailable: step 2: test preset "disabled-test": condition evaluated to false: false
|
||||
|
||||
"disabled-package-step"
|
||||
Unavailable: step 2: package preset "disabled-package": condition evaluated to false: false
|
||||
|
||||
"hidden-step"
|
||||
Unavailable: step 1: configure preset "hidden": hidden
|
||||
|
||||
"invalid-step"
|
||||
Unavailable: step 1: configure preset "invalid": unsupported macro expansion
|
||||
|
||||
"unsupported-generator-step"
|
||||
Unavailable: step 1: configure preset "unsupported-generator": generator "Invalid Generator" is not available
|
||||
|
||||
"hidden-build-step"
|
||||
Unavailable: step 2: build preset "hidden-build": hidden
|
||||
|
||||
"invalid-build-step"
|
||||
Unavailable: step 2: build preset "invalid-build": unsupported macro expansion
|
||||
|
||||
"hidden-test-step"
|
||||
Unavailable: step 2: test preset "hidden-test": hidden
|
||||
|
||||
"invalid-test-step"
|
||||
Unavailable: step 2: test preset "invalid-test": unsupported macro expansion
|
||||
|
||||
"hidden-package-step"
|
||||
Unavailable: step 2: package preset "hidden-package": hidden
|
||||
|
||||
"invalid-package-step"
|
||||
Unavailable: step 2: package preset "invalid-package": unsupported macro expansion$
|
||||
@@ -0,0 +1,126 @@
|
||||
^Defined configure presets:
|
||||
|
||||
"default"
|
||||
"disabled" +- Disabled Configure
|
||||
Unavailable: condition evaluated to false: false
|
||||
|
||||
"disabled-expression"
|
||||
"invalid"
|
||||
Unavailable: unsupported macro expansion
|
||||
|
||||
"unsupported-generator"
|
||||
Unavailable: generator "Invalid Generator" is not available
|
||||
|
||||
Defined build presets:
|
||||
|
||||
"default"
|
||||
"enabled-build"
|
||||
"disabled-build"
|
||||
Unavailable: condition evaluated to false: false
|
||||
|
||||
"disabled-configure-build"
|
||||
"disabled-build-and-configure"
|
||||
Unavailable: condition evaluated to false: false
|
||||
|
||||
"invalid-build"
|
||||
Unavailable: unsupported macro expansion
|
||||
|
||||
"hidden-configure-build"
|
||||
Unavailable: configure preset "hidden": hidden
|
||||
|
||||
"invalid-configure-build"
|
||||
Unavailable: configure preset "invalid": unsupported macro expansion
|
||||
|
||||
"unsupported-configure-build"
|
||||
Unavailable: configure preset "unsupported-generator": generator "Invalid Generator" is not available
|
||||
|
||||
Defined test presets:
|
||||
|
||||
"default"
|
||||
"enabled-test"
|
||||
"disabled-test"
|
||||
Unavailable: condition evaluated to false: false
|
||||
|
||||
"disabled-configure-test"
|
||||
"disabled-test-and-configure"
|
||||
Unavailable: condition evaluated to false: false
|
||||
|
||||
"invalid-test"
|
||||
Unavailable: unsupported macro expansion
|
||||
|
||||
"hidden-configure-test"
|
||||
Unavailable: configure preset "hidden": hidden
|
||||
|
||||
"invalid-configure-test"
|
||||
Unavailable: configure preset "invalid": unsupported macro expansion
|
||||
|
||||
"unsupported-configure-test"
|
||||
Unavailable: configure preset "unsupported-generator": generator "Invalid Generator" is not available
|
||||
|
||||
Defined package presets:
|
||||
|
||||
"default"
|
||||
"enabled-package"
|
||||
"disabled-package"
|
||||
Unavailable: condition evaluated to false: false
|
||||
|
||||
"disabled-configure-package"
|
||||
"disabled-package-and-configure"
|
||||
Unavailable: condition evaluated to false: false
|
||||
|
||||
"invalid-package"
|
||||
Unavailable: unsupported macro expansion
|
||||
|
||||
"hidden-configure-package"
|
||||
Unavailable: configure preset "hidden": hidden
|
||||
|
||||
"invalid-configure-package"
|
||||
Unavailable: configure preset "invalid": unsupported macro expansion
|
||||
|
||||
"unsupported-configure-package"
|
||||
Unavailable: configure preset "unsupported-generator": generator "Invalid Generator" is not available
|
||||
|
||||
Defined workflow presets:
|
||||
|
||||
"default"
|
||||
"with-description" +- With Description
|
||||
"enabled-dependent-steps"
|
||||
"disabled-step"
|
||||
Unavailable: step 1: configure preset "disabled": condition evaluated to false: false
|
||||
|
||||
"disabled-expression-step"
|
||||
"disabled-build-step"
|
||||
Unavailable: step 2: build preset "disabled-build": condition evaluated to false: false
|
||||
|
||||
"disabled-test-step"
|
||||
Unavailable: step 2: test preset "disabled-test": condition evaluated to false: false
|
||||
|
||||
"disabled-package-step"
|
||||
Unavailable: step 2: package preset "disabled-package": condition evaluated to false: false
|
||||
|
||||
"hidden-step"
|
||||
Unavailable: step 1: configure preset "hidden": hidden
|
||||
|
||||
"invalid-step"
|
||||
Unavailable: step 1: configure preset "invalid": unsupported macro expansion
|
||||
|
||||
"unsupported-generator-step"
|
||||
Unavailable: step 1: configure preset "unsupported-generator": generator "Invalid Generator" is not available
|
||||
|
||||
"hidden-build-step"
|
||||
Unavailable: step 2: build preset "hidden-build": hidden
|
||||
|
||||
"invalid-build-step"
|
||||
Unavailable: step 2: build preset "invalid-build": unsupported macro expansion
|
||||
|
||||
"hidden-test-step"
|
||||
Unavailable: step 2: test preset "hidden-test": hidden
|
||||
|
||||
"invalid-test-step"
|
||||
Unavailable: step 2: test preset "invalid-test": unsupported macro expansion
|
||||
|
||||
"hidden-package-step"
|
||||
Unavailable: step 2: package preset "hidden-package": hidden
|
||||
|
||||
"invalid-package-step"
|
||||
Unavailable: step 2: package preset "invalid-package": unsupported macro expansion$
|
||||
@@ -0,0 +1,46 @@
|
||||
^Defined workflow presets:
|
||||
|
||||
"default"
|
||||
"with-description" +- With Description
|
||||
"enabled-dependent-steps"
|
||||
"disabled-step"
|
||||
Unavailable: step 1: configure preset "disabled": condition evaluated to false: false
|
||||
|
||||
"disabled-expression-step"
|
||||
Unavailable: step 1: configure preset "disabled-expression": condition evaluated to false: .*CMAKE_PRESET_TEST_UNFULFILLED_ENV.*
|
||||
|
||||
"disabled-build-step"
|
||||
Unavailable: step 2: build preset "disabled-build": condition evaluated to false: false
|
||||
|
||||
"disabled-test-step"
|
||||
Unavailable: step 2: test preset "disabled-test": condition evaluated to false: false
|
||||
|
||||
"disabled-package-step"
|
||||
Unavailable: step 2: package preset "disabled-package": condition evaluated to false: false
|
||||
|
||||
"hidden-step"
|
||||
Unavailable: step 1: configure preset "hidden": hidden
|
||||
|
||||
"invalid-step"
|
||||
Unavailable: step 1: configure preset "invalid": unsupported macro expansion
|
||||
|
||||
"unsupported-generator-step"
|
||||
Unavailable: step 1: configure preset "unsupported-generator": generator "Invalid Generator" is not available
|
||||
|
||||
"hidden-build-step"
|
||||
Unavailable: step 2: build preset "hidden-build": hidden
|
||||
|
||||
"invalid-build-step"
|
||||
Unavailable: step 2: build preset "invalid-build": unsupported macro expansion
|
||||
|
||||
"hidden-test-step"
|
||||
Unavailable: step 2: test preset "hidden-test": hidden
|
||||
|
||||
"invalid-test-step"
|
||||
Unavailable: step 2: test preset "invalid-test": unsupported macro expansion
|
||||
|
||||
"hidden-package-step"
|
||||
Unavailable: step 2: package preset "hidden-package": hidden
|
||||
|
||||
"invalid-package-step"
|
||||
Unavailable: step 2: package preset "invalid-package": unsupported macro expansion$
|
||||
@@ -0,0 +1,24 @@
|
||||
^Defined test presets:
|
||||
|
||||
"default"
|
||||
"enabled-test"
|
||||
"disabled-test"
|
||||
Unavailable: condition evaluated to false: false
|
||||
|
||||
"disabled-configure-test"
|
||||
Unavailable: configure preset "disabled-expression": condition evaluated to false: .*CMAKE_PRESET_TEST_UNFULFILLED_ENV.*
|
||||
|
||||
"disabled-test-and-configure"
|
||||
Unavailable: condition evaluated to false: false
|
||||
|
||||
"invalid-test"
|
||||
Unavailable: unsupported macro expansion
|
||||
|
||||
"hidden-configure-test"
|
||||
Unavailable: configure preset "hidden": hidden
|
||||
|
||||
"invalid-configure-test"
|
||||
Unavailable: configure preset "invalid": unsupported macro expansion
|
||||
|
||||
"unsupported-configure-test"
|
||||
Unavailable: configure preset "unsupported-generator": generator "Invalid Generator" is not available$
|
||||
@@ -0,0 +1,4 @@
|
||||
^Available package presets:
|
||||
|
||||
"default"
|
||||
"enabled-package"$
|
||||
@@ -0,0 +1,4 @@
|
||||
^Available package presets:
|
||||
|
||||
"default"
|
||||
"enabled-package"$
|
||||
@@ -0,0 +1 @@
|
||||
1
|
||||
@@ -0,0 +1,2 @@
|
||||
^CMake Error: Invalid value specified for --list-presets\.
|
||||
The only supported value is "defined"\.$
|
||||
@@ -1,4 +1,5 @@
|
||||
^Available workflow presets:
|
||||
|
||||
"default"
|
||||
"with-description" - With Description$
|
||||
"with-description" +- With Description
|
||||
"enabled-dependent-steps"$
|
||||
|
||||
@@ -3,6 +3,181 @@
|
||||
"configurePresets": [
|
||||
{
|
||||
"name": "default"
|
||||
},
|
||||
{
|
||||
"name": "disabled",
|
||||
"displayName": "Disabled Configure",
|
||||
"condition": false
|
||||
},
|
||||
{
|
||||
"name": "disabled-expression",
|
||||
"condition": {
|
||||
"type": "equals",
|
||||
"lhs": "$env{CMAKE_PRESET_TEST_UNFULFILLED_ENV}",
|
||||
"rhs": "set_value"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "hidden",
|
||||
"hidden": true
|
||||
},
|
||||
{
|
||||
"name": "invalid",
|
||||
"binaryDir": "$vendor{invalid}"
|
||||
},
|
||||
{
|
||||
"name": "unsupported-generator",
|
||||
"generator": "Invalid Generator"
|
||||
}
|
||||
],
|
||||
"buildPresets": [
|
||||
{
|
||||
"name": "default",
|
||||
"configurePreset": "default"
|
||||
},
|
||||
{
|
||||
"name": "enabled-build",
|
||||
"configurePreset": "default",
|
||||
"condition": true
|
||||
},
|
||||
{
|
||||
"name": "disabled-build",
|
||||
"configurePreset": "default",
|
||||
"condition": false
|
||||
},
|
||||
{
|
||||
"name": "disabled-configure-build",
|
||||
"configurePreset": "disabled-expression",
|
||||
"condition": true
|
||||
},
|
||||
{
|
||||
"name": "disabled-build-and-configure",
|
||||
"configurePreset": "disabled-expression",
|
||||
"condition": false
|
||||
},
|
||||
{
|
||||
"name": "hidden-build",
|
||||
"hidden": true,
|
||||
"configurePreset": "default"
|
||||
},
|
||||
{
|
||||
"name": "invalid-build",
|
||||
"configurePreset": "default",
|
||||
"environment": {
|
||||
"INVALID": "$vendor{invalid}"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "hidden-configure-build",
|
||||
"configurePreset": "hidden"
|
||||
},
|
||||
{
|
||||
"name": "invalid-configure-build",
|
||||
"configurePreset": "invalid"
|
||||
},
|
||||
{
|
||||
"name": "unsupported-configure-build",
|
||||
"configurePreset": "unsupported-generator"
|
||||
}
|
||||
],
|
||||
"testPresets": [
|
||||
{
|
||||
"name": "default",
|
||||
"configurePreset": "default"
|
||||
},
|
||||
{
|
||||
"name": "enabled-test",
|
||||
"configurePreset": "default",
|
||||
"condition": true
|
||||
},
|
||||
{
|
||||
"name": "disabled-test",
|
||||
"configurePreset": "default",
|
||||
"condition": false
|
||||
},
|
||||
{
|
||||
"name": "disabled-configure-test",
|
||||
"configurePreset": "disabled-expression",
|
||||
"condition": true
|
||||
},
|
||||
{
|
||||
"name": "disabled-test-and-configure",
|
||||
"configurePreset": "disabled-expression",
|
||||
"condition": false
|
||||
},
|
||||
{
|
||||
"name": "hidden-test",
|
||||
"hidden": true,
|
||||
"configurePreset": "default"
|
||||
},
|
||||
{
|
||||
"name": "invalid-test",
|
||||
"configurePreset": "default",
|
||||
"environment": {
|
||||
"INVALID": "$vendor{invalid}"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "hidden-configure-test",
|
||||
"configurePreset": "hidden"
|
||||
},
|
||||
{
|
||||
"name": "invalid-configure-test",
|
||||
"configurePreset": "invalid"
|
||||
},
|
||||
{
|
||||
"name": "unsupported-configure-test",
|
||||
"configurePreset": "unsupported-generator"
|
||||
}
|
||||
],
|
||||
"packagePresets": [
|
||||
{
|
||||
"name": "default",
|
||||
"configurePreset": "default"
|
||||
},
|
||||
{
|
||||
"name": "enabled-package",
|
||||
"configurePreset": "default",
|
||||
"condition": true
|
||||
},
|
||||
{
|
||||
"name": "disabled-package",
|
||||
"configurePreset": "default",
|
||||
"condition": false
|
||||
},
|
||||
{
|
||||
"name": "disabled-configure-package",
|
||||
"configurePreset": "disabled-expression",
|
||||
"condition": true
|
||||
},
|
||||
{
|
||||
"name": "disabled-package-and-configure",
|
||||
"configurePreset": "disabled-expression",
|
||||
"condition": false
|
||||
},
|
||||
{
|
||||
"name": "hidden-package",
|
||||
"hidden": true,
|
||||
"configurePreset": "default"
|
||||
},
|
||||
{
|
||||
"name": "invalid-package",
|
||||
"configurePreset": "default",
|
||||
"environment": {
|
||||
"INVALID": "$vendor{invalid}"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "hidden-configure-package",
|
||||
"configurePreset": "hidden"
|
||||
},
|
||||
{
|
||||
"name": "invalid-configure-package",
|
||||
"configurePreset": "invalid"
|
||||
},
|
||||
{
|
||||
"name": "unsupported-configure-package",
|
||||
"configurePreset": "unsupported-generator"
|
||||
}
|
||||
],
|
||||
"workflowPresets": [
|
||||
@@ -25,6 +200,189 @@
|
||||
"name": "default"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "enabled-dependent-steps",
|
||||
"steps": [
|
||||
{
|
||||
"type": "configure",
|
||||
"name": "default"
|
||||
},
|
||||
{
|
||||
"type": "build",
|
||||
"name": "enabled-build"
|
||||
},
|
||||
{
|
||||
"type": "test",
|
||||
"name": "enabled-test"
|
||||
},
|
||||
{
|
||||
"type": "package",
|
||||
"name": "enabled-package"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "disabled-step",
|
||||
"steps": [
|
||||
{
|
||||
"type": "configure",
|
||||
"name": "disabled"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "disabled-expression-step",
|
||||
"steps": [
|
||||
{
|
||||
"type": "configure",
|
||||
"name": "disabled-expression"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "disabled-build-step",
|
||||
"steps": [
|
||||
{
|
||||
"type": "configure",
|
||||
"name": "default"
|
||||
},
|
||||
{
|
||||
"type": "build",
|
||||
"name": "disabled-build"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "disabled-test-step",
|
||||
"steps": [
|
||||
{
|
||||
"type": "configure",
|
||||
"name": "default"
|
||||
},
|
||||
{
|
||||
"type": "test",
|
||||
"name": "disabled-test"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "disabled-package-step",
|
||||
"steps": [
|
||||
{
|
||||
"type": "configure",
|
||||
"name": "default"
|
||||
},
|
||||
{
|
||||
"type": "package",
|
||||
"name": "disabled-package"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "hidden-step",
|
||||
"steps": [
|
||||
{
|
||||
"type": "configure",
|
||||
"name": "hidden"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "invalid-step",
|
||||
"steps": [
|
||||
{
|
||||
"type": "configure",
|
||||
"name": "invalid"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "unsupported-generator-step",
|
||||
"steps": [
|
||||
{
|
||||
"type": "configure",
|
||||
"name": "unsupported-generator"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "hidden-build-step",
|
||||
"steps": [
|
||||
{
|
||||
"type": "configure",
|
||||
"name": "default"
|
||||
},
|
||||
{
|
||||
"type": "build",
|
||||
"name": "hidden-build"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "invalid-build-step",
|
||||
"steps": [
|
||||
{
|
||||
"type": "configure",
|
||||
"name": "default"
|
||||
},
|
||||
{
|
||||
"type": "build",
|
||||
"name": "invalid-build"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "hidden-test-step",
|
||||
"steps": [
|
||||
{
|
||||
"type": "configure",
|
||||
"name": "default"
|
||||
},
|
||||
{
|
||||
"type": "test",
|
||||
"name": "hidden-test"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "invalid-test-step",
|
||||
"steps": [
|
||||
{
|
||||
"type": "configure",
|
||||
"name": "default"
|
||||
},
|
||||
{
|
||||
"type": "test",
|
||||
"name": "invalid-test"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "hidden-package-step",
|
||||
"steps": [
|
||||
{
|
||||
"type": "configure",
|
||||
"name": "default"
|
||||
},
|
||||
{
|
||||
"type": "package",
|
||||
"name": "hidden-package"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "invalid-package-step",
|
||||
"steps": [
|
||||
{
|
||||
"type": "configure",
|
||||
"name": "default"
|
||||
},
|
||||
{
|
||||
"type": "package",
|
||||
"name": "invalid-package"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
1
|
||||
@@ -0,0 +1,8 @@
|
||||
^Invalid value specified for --list-presets\.
|
||||
The only supported value in workflow mode is "defined"\.
|
||||
Usage: cmake --workflow <options>
|
||||
Options:
|
||||
--preset <preset> = Workflow preset to execute\.
|
||||
--presets-file <file> = Path to a presets file\.
|
||||
--list-presets\[=defined\] = List available or all defined workflow presets\.
|
||||
--fresh = Configure a fresh build tree, removing any existing cache file\.$
|
||||
@@ -0,0 +1,4 @@
|
||||
^Available test presets:
|
||||
|
||||
"default"
|
||||
"enabled-test"$
|
||||
@@ -0,0 +1,4 @@
|
||||
^Available test presets:
|
||||
|
||||
"default"
|
||||
"enabled-test"$
|
||||
@@ -0,0 +1 @@
|
||||
1
|
||||
@@ -0,0 +1,2 @@
|
||||
^CMake Error: Invalid value specified for --list-presets\.
|
||||
The only supported value is "defined"\.$
|
||||
@@ -0,0 +1,5 @@
|
||||
^Available workflow presets:
|
||||
|
||||
"default"
|
||||
"with-description" +- With Description
|
||||
"enabled-dependent-steps"$
|
||||
@@ -51,7 +51,9 @@ function(run_cmake_workflow_presets name)
|
||||
set(RunCMake-check-file "check.cmake")
|
||||
endif()
|
||||
|
||||
if(CMakePresets_DIRECT_ARG)
|
||||
if(CMakePresets_NO_PRESET)
|
||||
set(preset_arg)
|
||||
elseif(CMakePresets_DIRECT_ARG)
|
||||
set(preset_arg "${name}")
|
||||
elseif(eq)
|
||||
set(eq 0 PARENT_SCOPE)
|
||||
@@ -95,10 +97,144 @@ unset(CMakePresets_FILE)
|
||||
unset(CMakePresets_FILE_ARG)
|
||||
|
||||
run_cmake_workflow_presets(ListPresets --list-presets)
|
||||
set(CMakePresets_FILE "${RunCMake_SOURCE_DIR}/ListPresets.json.in")
|
||||
unset(ENV{CMAKE_PRESET_TEST_UNFULFILLED_ENV})
|
||||
set(CMakePresets_NO_PRESET TRUE)
|
||||
run_cmake_workflow_presets(ListAllPresets --list-presets)
|
||||
run_cmake_workflow_presets(ListDefinedPresets --list-presets=defined)
|
||||
unset(CMakePresets_NO_PRESET)
|
||||
run_cmake_command(ListAllPresetTypes
|
||||
${CMAKE_COMMAND}
|
||||
-S "${RunCMake_BINARY_DIR}/ListAllPresets"
|
||||
--list-presets=all
|
||||
)
|
||||
run_cmake_command(ListDefinedPresetTypes
|
||||
${CMAKE_COMMAND}
|
||||
-S "${RunCMake_BINARY_DIR}/ListAllPresets"
|
||||
--list-presets=all-defined
|
||||
)
|
||||
set(RunCMake-stdout-file ListDefinedConfigurePresetTypes-stdout.txt)
|
||||
run_cmake_command(ListDefinedConfigurePresetTypes
|
||||
${CMAKE_COMMAND}
|
||||
-S "${RunCMake_BINARY_DIR}/ListAllPresets"
|
||||
--list-presets=defined
|
||||
)
|
||||
run_cmake_command(ListConfigureDefinedPresetTypes
|
||||
${CMAKE_COMMAND}
|
||||
-S "${RunCMake_BINARY_DIR}/ListAllPresets"
|
||||
--list-presets=configure-defined
|
||||
)
|
||||
unset(RunCMake-stdout-file)
|
||||
run_cmake_command(ListBuildPresetTypes
|
||||
${CMAKE_COMMAND}
|
||||
-S "${RunCMake_BINARY_DIR}/ListAllPresets"
|
||||
--list-presets=build
|
||||
)
|
||||
run_cmake_command(ListTestPresetTypes
|
||||
${CMAKE_COMMAND}
|
||||
-S "${RunCMake_BINARY_DIR}/ListAllPresets"
|
||||
--list-presets=test
|
||||
)
|
||||
run_cmake_command(ListPackagePresetTypes
|
||||
${CMAKE_COMMAND}
|
||||
-S "${RunCMake_BINARY_DIR}/ListAllPresets"
|
||||
--list-presets=package
|
||||
)
|
||||
run_cmake_command(ListWorkflowPresetTypes
|
||||
${CMAKE_COMMAND}
|
||||
-S "${RunCMake_BINARY_DIR}/ListAllPresets"
|
||||
--list-presets=workflow
|
||||
)
|
||||
set(RunCMake-stdout-file ListDefinedBuildPresetsCommand-stdout.txt)
|
||||
run_cmake_command(ListBuildDefinedPresetTypes
|
||||
${CMAKE_COMMAND}
|
||||
-S "${RunCMake_BINARY_DIR}/ListAllPresets"
|
||||
--list-presets=build-defined
|
||||
)
|
||||
unset(RunCMake-stdout-file)
|
||||
set(RunCMake-stdout-file ListDefinedTestPresetsCommand-stdout.txt)
|
||||
run_cmake_command(ListTestDefinedPresetTypes
|
||||
${CMAKE_COMMAND}
|
||||
-S "${RunCMake_BINARY_DIR}/ListAllPresets"
|
||||
--list-presets=test-defined
|
||||
)
|
||||
unset(RunCMake-stdout-file)
|
||||
set(RunCMake-stdout-file ListDefinedPackagePresetsCommand-stdout.txt)
|
||||
run_cmake_command(ListPackageDefinedPresetTypes
|
||||
${CMAKE_COMMAND}
|
||||
-S "${RunCMake_BINARY_DIR}/ListAllPresets"
|
||||
--list-presets=package-defined
|
||||
)
|
||||
unset(RunCMake-stdout-file)
|
||||
set(RunCMake-stdout-file ListDefinedPresets-stdout.txt)
|
||||
run_cmake_command(ListWorkflowDefinedPresetTypes
|
||||
${CMAKE_COMMAND}
|
||||
-S "${RunCMake_BINARY_DIR}/ListAllPresets"
|
||||
--list-presets=workflow-defined
|
||||
)
|
||||
unset(RunCMake-stdout-file)
|
||||
set(ListPresets_FILE
|
||||
"${RunCMake_BINARY_DIR}/ListAllPresets/CMakePresets.json")
|
||||
run_cmake_command(ListBuildPresetsCommand
|
||||
${CMAKE_COMMAND}
|
||||
--build
|
||||
"--presets-file=${ListPresets_FILE}"
|
||||
--list-presets
|
||||
)
|
||||
run_cmake_command(ListDefinedBuildPresetsCommand
|
||||
${CMAKE_COMMAND}
|
||||
--build
|
||||
"--presets-file=${ListPresets_FILE}"
|
||||
--list-presets=defined
|
||||
)
|
||||
run_cmake_command(ListTestPresetsCommand
|
||||
${CMAKE_CTEST_COMMAND}
|
||||
"--presets-file=${ListPresets_FILE}"
|
||||
--list-presets
|
||||
)
|
||||
run_cmake_command(ListDefinedTestPresetsCommand
|
||||
${CMAKE_CTEST_COMMAND}
|
||||
"--presets-file=${ListPresets_FILE}"
|
||||
--list-presets=defined
|
||||
)
|
||||
run_cmake_command(ListPackagePresetsCommand
|
||||
${CMAKE_CPACK_COMMAND}
|
||||
"--presets-file=${ListPresets_FILE}"
|
||||
--list-presets
|
||||
)
|
||||
run_cmake_command(ListDefinedPackagePresetsCommand
|
||||
${CMAKE_CPACK_COMMAND}
|
||||
"--presets-file=${ListPresets_FILE}"
|
||||
--list-presets=defined
|
||||
)
|
||||
run_cmake_command(ListTestPresetsInvalidValue
|
||||
${CMAKE_CTEST_COMMAND}
|
||||
--list-presets=invalid
|
||||
)
|
||||
run_cmake_command(ListPackagePresetsInvalidValue
|
||||
${CMAKE_CPACK_COMMAND}
|
||||
--list-presets=invalid
|
||||
)
|
||||
set(ENV{CMAKE_PRESET_TEST_UNFULFILLED_ENV} "set_value")
|
||||
run_cmake_command(ListAllPresetTypesConditionTrue
|
||||
${CMAKE_COMMAND}
|
||||
-S "${RunCMake_BINARY_DIR}/ListAllPresets"
|
||||
--list-presets=all
|
||||
)
|
||||
run_cmake_command(ListDefinedPresetTypesConditionTrue
|
||||
${CMAKE_COMMAND}
|
||||
-S "${RunCMake_BINARY_DIR}/ListAllPresets"
|
||||
--list-presets=all-defined
|
||||
)
|
||||
unset(ENV{CMAKE_PRESET_TEST_UNFULFILLED_ENV})
|
||||
unset(ListPresets_FILE)
|
||||
unset(CMakePresets_FILE)
|
||||
|
||||
run_cmake_command(PresetsNoArg-workflow ${CMAKE_COMMAND} "--workflow" "--preset")
|
||||
run_cmake_command(PresetsNoArgEq-workflow ${CMAKE_COMMAND} "--workflow" "--preset=")
|
||||
run_cmake_command(PresetsFileNoArg-workflow ${CMAKE_COMMAND} "--workflow" "--presets-file")
|
||||
run_cmake_workflow_presets(InvalidOption -DINVALID_OPTION)
|
||||
run_cmake_workflow_presets(ListPresetsInvalidValue --list-presets=invalid)
|
||||
|
||||
set(RunCMake_TEST_NO_CLEAN TRUE)
|
||||
file(REMOVE_RECURSE "${RunCMake_BINARY_DIR}/Fresh")
|
||||
|
||||
Reference in New Issue
Block a user