Replace cmArray{Begin,End,Size} by their standard counterparts

std::{begin,end} are part of C++11, std::{cbegin,cend} are part of C++14
and an standard compliant implementation has been introduced within the
'cm' namespace: cm::{cbegin,cend}.

std::size is only part of C++17, hence exposing a compliant implementation
within namespace cm (cm::size).

where possible, the standard implementations are reused.
This commit is contained in:
Matthias Maennich 2017-10-05 12:43:06 +02:00
parent fa501bc826
commit 57132765e0
9 changed files with 147 additions and 105 deletions

View File

@ -42,22 +42,6 @@ inline bool cmHasLiteralSuffixImpl(const char* str1, const char* str2,
return len >= N && strcmp(str1 + len - N, str2) == 0;
}
template <typename T, size_t N>
const T* cmArrayBegin(const T (&a)[N])
{
return a;
}
template <typename T, size_t N>
const T* cmArrayEnd(const T (&a)[N])
{
return a + N;
}
template <typename T, size_t N>
size_t cmArraySize(const T (&)[N])
{
return N;
}
template <typename T, size_t N>
bool cmHasLiteralPrefix(const T& str1, const char (&str2)[N])
{
@ -418,6 +402,67 @@ std::unique_ptr<T> make_unique(Args&&... args)
#endif
#if __cplusplus >= 201703L || defined(_MSVC_LANG) && _MSVC_LANG >= 201703L
using std::size;
#else
// std::size backport from C++17.
template <class C>
#if !defined(_MSC_VER) || _MSC_VER >= 1900
constexpr
#endif
auto
size(C const& c) -> decltype(c.size())
{
return c.size();
}
template <typename T, size_t N>
#if !defined(_MSC_VER) || _MSC_VER >= 1900
constexpr
#endif
std::size_t
size(const T (&)[N]) throw()
{
return N;
}
#endif
#if __cplusplus >= 201402L || defined(_MSVC_LANG) && _MSVC_LANG >= 201402L
using std::cbegin;
using std::cend;
#else
// std::c{begin,end} backport from C++14
template <class C>
#if defined(_MSC_VER) && _MSC_VER < 1900
auto cbegin(C const& c)
#else
constexpr auto cbegin(C const& c) noexcept(noexcept(std::begin(c)))
#endif
-> decltype(std::begin(c))
{
return std::begin(c);
}
template <class C>
#if defined(_MSC_VER) && _MSC_VER < 1900
auto cend(C const& c)
#else
constexpr auto cend(C const& c) noexcept(noexcept(std::end(c)))
#endif
-> decltype(std::end(c))
{
return std::end(c);
}
#endif
} // namespace cm
#endif

View File

@ -1035,7 +1035,7 @@ static const struct TargetPropertyNode : public cmGeneratorExpressionNode
// No error. We just skip cyclic references.
return std::string();
case cmGeneratorExpressionDAGChecker::ALREADY_SEEN:
for (size_t i = 1; i < cmArraySize(targetPropertyTransitiveWhitelist);
for (size_t i = 1; i < cm::size(targetPropertyTransitiveWhitelist);
++i) {
if (targetPropertyTransitiveWhitelist[i] == propertyName) {
// No error. We're not going to find anything new here.
@ -1443,7 +1443,7 @@ static const struct TargetPolicyNode : public cmGeneratorExpressionNode
context->HadContextSensitiveCondition = true;
context->HadHeadSensitiveCondition = true;
for (size_t i = 1; i < cmArraySize(targetPolicyWhitelist); ++i) {
for (size_t i = 1; i < cm::size(targetPolicyWhitelist); ++i) {
const char* policy = targetPolicyWhitelist[i];
if (parameters.front() == policy) {
cmLocalGenerator* lg = context->HeadTarget->GetLocalGenerator();

View File

@ -2519,8 +2519,8 @@ bool cmGlobalGenerator::IsReservedTarget(std::string const& name)
"RUN_TESTS", "package", "PACKAGE", "package_source", "ZERO_CHECK"
};
return std::find(cmArrayBegin(reservedTargets), cmArrayEnd(reservedTargets),
name) != cmArrayEnd(reservedTargets);
return std::find(cm::cbegin(reservedTargets), cm::cend(reservedTargets),
name) != cm::cend(reservedTargets);
}
void cmGlobalGenerator::SetExternalMakefileProjectGenerator(

View File

@ -135,8 +135,8 @@ cmLocalGenerator::cmLocalGenerator(cmGlobalGenerator* gg, cmMakefile* makefile)
this->VariableMappings[compilerOptionSysroot] =
this->Makefile->GetSafeDefinition(compilerOptionSysroot);
for (const char* const* replaceIter = cmArrayBegin(ruleReplaceVars);
replaceIter != cmArrayEnd(ruleReplaceVars); ++replaceIter) {
for (const char* const* replaceIter = cm::cbegin(ruleReplaceVars);
replaceIter != cm::cend(ruleReplaceVars); ++replaceIter) {
std::string actualReplace = *replaceIter;
if (actualReplace.find("${LANG}") != std::string::npos) {
cmSystemTools::ReplaceString(actualReplace, "${LANG}", lang);

View File

@ -7,6 +7,7 @@
#include <algorithm>
#include <assert.h>
#include <ctype.h>
#include <iterator>
#include <memory> // IWYU pragma: keep
#include <sstream>
#include <stdlib.h>
@ -4133,15 +4134,15 @@ bool cmMakefile::CompileFeatureKnown(cmTarget const* target,
assert(cmGeneratorExpression::Find(feature) == std::string::npos);
bool isCFeature =
std::find_if(cmArrayBegin(C_FEATURES) + 1, cmArrayEnd(C_FEATURES),
cmStrCmp(feature)) != cmArrayEnd(C_FEATURES);
std::find_if(cm::cbegin(C_FEATURES) + 1, cm::cend(C_FEATURES),
cmStrCmp(feature)) != cm::cend(C_FEATURES);
if (isCFeature) {
lang = "C";
return true;
}
bool isCxxFeature =
std::find_if(cmArrayBegin(CXX_FEATURES) + 1, cmArrayEnd(CXX_FEATURES),
cmStrCmp(feature)) != cmArrayEnd(CXX_FEATURES);
std::find_if(cm::cbegin(CXX_FEATURES) + 1, cm::cend(CXX_FEATURES),
cmStrCmp(feature)) != cm::cend(CXX_FEATURES);
if (isCxxFeature) {
lang = "CXX";
return true;
@ -4230,8 +4231,8 @@ bool cmMakefile::HaveCStandardAvailable(cmTarget const* target,
// Return true so the caller does not try to lookup the default standard.
return true;
}
if (std::find_if(cmArrayBegin(C_STANDARDS), cmArrayEnd(C_STANDARDS),
cmStrCmp(defaultCStandard)) == cmArrayEnd(C_STANDARDS)) {
if (std::find_if(cm::cbegin(C_STANDARDS), cm::cend(C_STANDARDS),
cmStrCmp(defaultCStandard)) == cm::cend(C_STANDARDS)) {
std::ostringstream e;
e << "The CMAKE_C_STANDARD_DEFAULT variable contains an "
"invalid value: \""
@ -4251,8 +4252,8 @@ bool cmMakefile::HaveCStandardAvailable(cmTarget const* target,
existingCStandard = defaultCStandard;
}
if (std::find_if(cmArrayBegin(C_STANDARDS), cmArrayEnd(C_STANDARDS),
cmStrCmp(existingCStandard)) == cmArrayEnd(C_STANDARDS)) {
if (std::find_if(cm::cbegin(C_STANDARDS), cm::cend(C_STANDARDS),
cmStrCmp(existingCStandard)) == cm::cend(C_STANDARDS)) {
std::ostringstream e;
e << "The C_STANDARD property on target \"" << target->GetName()
<< "\" contained an invalid value: \"" << existingCStandard << "\".";
@ -4261,23 +4262,23 @@ bool cmMakefile::HaveCStandardAvailable(cmTarget const* target,
}
const char* const* existingCIt = existingCStandard
? std::find_if(cmArrayBegin(C_STANDARDS), cmArrayEnd(C_STANDARDS),
? std::find_if(cm::cbegin(C_STANDARDS), cm::cend(C_STANDARDS),
cmStrCmp(existingCStandard))
: cmArrayEnd(C_STANDARDS);
: cm::cend(C_STANDARDS);
if (needC11 && existingCStandard &&
existingCIt < std::find_if(cmArrayBegin(C_STANDARDS),
cmArrayEnd(C_STANDARDS), cmStrCmp("11"))) {
existingCIt < std::find_if(cm::cbegin(C_STANDARDS),
cm::cend(C_STANDARDS), cmStrCmp("11"))) {
return false;
}
if (needC99 && existingCStandard &&
existingCIt < std::find_if(cmArrayBegin(C_STANDARDS),
cmArrayEnd(C_STANDARDS), cmStrCmp("99"))) {
existingCIt < std::find_if(cm::cbegin(C_STANDARDS),
cm::cend(C_STANDARDS), cmStrCmp("99"))) {
return false;
}
if (needC90 && existingCStandard &&
existingCIt < std::find_if(cmArrayBegin(C_STANDARDS),
cmArrayEnd(C_STANDARDS), cmStrCmp("90"))) {
existingCIt < std::find_if(cm::cbegin(C_STANDARDS),
cm::cend(C_STANDARDS), cmStrCmp("90"))) {
return false;
}
return true;
@ -4289,16 +4290,16 @@ bool cmMakefile::IsLaterStandard(std::string const& lang,
{
if (lang == "C") {
const char* const* rhsIt = std::find_if(
cmArrayBegin(C_STANDARDS), cmArrayEnd(C_STANDARDS), cmStrCmp(rhs));
cm::cbegin(C_STANDARDS), cm::cend(C_STANDARDS), cmStrCmp(rhs));
return std::find_if(rhsIt, cmArrayEnd(C_STANDARDS), cmStrCmp(lhs)) !=
cmArrayEnd(C_STANDARDS);
return std::find_if(rhsIt, cm::cend(C_STANDARDS), cmStrCmp(lhs)) !=
cm::cend(C_STANDARDS);
}
const char* const* rhsIt = std::find_if(
cmArrayBegin(CXX_STANDARDS), cmArrayEnd(CXX_STANDARDS), cmStrCmp(rhs));
cm::cbegin(CXX_STANDARDS), cm::cend(CXX_STANDARDS), cmStrCmp(rhs));
return std::find_if(rhsIt, cmArrayEnd(CXX_STANDARDS), cmStrCmp(lhs)) !=
cmArrayEnd(CXX_STANDARDS);
return std::find_if(rhsIt, cm::cend(CXX_STANDARDS), cmStrCmp(lhs)) !=
cm::cend(CXX_STANDARDS);
}
bool cmMakefile::HaveCxxStandardAvailable(cmTarget const* target,
@ -4314,9 +4315,8 @@ bool cmMakefile::HaveCxxStandardAvailable(cmTarget const* target,
// Return true so the caller does not try to lookup the default standard.
return true;
}
if (std::find_if(cmArrayBegin(CXX_STANDARDS), cmArrayEnd(CXX_STANDARDS),
cmStrCmp(defaultCxxStandard)) ==
cmArrayEnd(CXX_STANDARDS)) {
if (std::find_if(cm::cbegin(CXX_STANDARDS), cm::cend(CXX_STANDARDS),
cmStrCmp(defaultCxxStandard)) == cm::cend(CXX_STANDARDS)) {
std::ostringstream e;
e << "The CMAKE_CXX_STANDARD_DEFAULT variable contains an "
"invalid value: \""
@ -4337,9 +4337,8 @@ bool cmMakefile::HaveCxxStandardAvailable(cmTarget const* target,
existingCxxStandard = defaultCxxStandard;
}
if (std::find_if(cmArrayBegin(CXX_STANDARDS), cmArrayEnd(CXX_STANDARDS),
cmStrCmp(existingCxxStandard)) ==
cmArrayEnd(CXX_STANDARDS)) {
if (std::find_if(cm::cbegin(CXX_STANDARDS), cm::cend(CXX_STANDARDS),
cmStrCmp(existingCxxStandard)) == cm::cend(CXX_STANDARDS)) {
std::ostringstream e;
e << "The CXX_STANDARD property on target \"" << target->GetName()
<< "\" contained an invalid value: \"" << existingCxxStandard << "\".";
@ -4348,32 +4347,28 @@ bool cmMakefile::HaveCxxStandardAvailable(cmTarget const* target,
}
const char* const* existingCxxIt = existingCxxStandard
? std::find_if(cmArrayBegin(CXX_STANDARDS), cmArrayEnd(CXX_STANDARDS),
? std::find_if(cm::cbegin(CXX_STANDARDS), cm::cend(CXX_STANDARDS),
cmStrCmp(existingCxxStandard))
: cmArrayEnd(CXX_STANDARDS);
: cm::cend(CXX_STANDARDS);
if (needCxx17 &&
existingCxxIt < std::find_if(cmArrayBegin(CXX_STANDARDS),
cmArrayEnd(CXX_STANDARDS),
cmStrCmp("17"))) {
existingCxxIt < std::find_if(cm::cbegin(CXX_STANDARDS),
cm::cend(CXX_STANDARDS), cmStrCmp("17"))) {
return false;
}
if (needCxx14 &&
existingCxxIt < std::find_if(cmArrayBegin(CXX_STANDARDS),
cmArrayEnd(CXX_STANDARDS),
cmStrCmp("14"))) {
existingCxxIt < std::find_if(cm::cbegin(CXX_STANDARDS),
cm::cend(CXX_STANDARDS), cmStrCmp("14"))) {
return false;
}
if (needCxx11 &&
existingCxxIt < std::find_if(cmArrayBegin(CXX_STANDARDS),
cmArrayEnd(CXX_STANDARDS),
cmStrCmp("11"))) {
existingCxxIt < std::find_if(cm::cbegin(CXX_STANDARDS),
cm::cend(CXX_STANDARDS), cmStrCmp("11"))) {
return false;
}
if (needCxx98 &&
existingCxxIt < std::find_if(cmArrayBegin(CXX_STANDARDS),
cmArrayEnd(CXX_STANDARDS),
cmStrCmp("98"))) {
existingCxxIt < std::find_if(cm::cbegin(CXX_STANDARDS),
cm::cend(CXX_STANDARDS), cmStrCmp("98"))) {
return false;
}
return true;
@ -4423,9 +4418,9 @@ bool cmMakefile::AddRequiredTargetCxxFeature(cmTarget* target,
const char* existingCxxStandard = target->GetProperty("CXX_STANDARD");
if (existingCxxStandard) {
if (std::find_if(cmArrayBegin(CXX_STANDARDS), cmArrayEnd(CXX_STANDARDS),
if (std::find_if(cm::cbegin(CXX_STANDARDS), cm::cend(CXX_STANDARDS),
cmStrCmp(existingCxxStandard)) ==
cmArrayEnd(CXX_STANDARDS)) {
cm::cend(CXX_STANDARDS)) {
std::ostringstream e;
e << "The CXX_STANDARD property on target \"" << target->GetName()
<< "\" contained an invalid value: \"" << existingCxxStandard << "\".";
@ -4439,9 +4434,9 @@ bool cmMakefile::AddRequiredTargetCxxFeature(cmTarget* target,
}
}
const char* const* existingCxxIt = existingCxxStandard
? std::find_if(cmArrayBegin(CXX_STANDARDS), cmArrayEnd(CXX_STANDARDS),
? std::find_if(cm::cbegin(CXX_STANDARDS), cm::cend(CXX_STANDARDS),
cmStrCmp(existingCxxStandard))
: cmArrayEnd(CXX_STANDARDS);
: cm::cend(CXX_STANDARDS);
bool setCxx98 = needCxx98 && !existingCxxStandard;
bool setCxx11 = needCxx11 && !existingCxxStandard;
@ -4449,23 +4444,22 @@ bool cmMakefile::AddRequiredTargetCxxFeature(cmTarget* target,
bool setCxx17 = needCxx17 && !existingCxxStandard;
if (needCxx17 && existingCxxStandard &&
existingCxxIt < std::find_if(cmArrayBegin(CXX_STANDARDS),
cmArrayEnd(CXX_STANDARDS),
cmStrCmp("17"))) {
existingCxxIt < std::find_if(cm::cbegin(CXX_STANDARDS),
cm::cend(CXX_STANDARDS), cmStrCmp("17"))) {
setCxx17 = true;
} else if (needCxx14 && existingCxxStandard &&
existingCxxIt < std::find_if(cmArrayBegin(CXX_STANDARDS),
cmArrayEnd(CXX_STANDARDS),
existingCxxIt < std::find_if(cm::cbegin(CXX_STANDARDS),
cm::cend(CXX_STANDARDS),
cmStrCmp("14"))) {
setCxx14 = true;
} else if (needCxx11 && existingCxxStandard &&
existingCxxIt < std::find_if(cmArrayBegin(CXX_STANDARDS),
cmArrayEnd(CXX_STANDARDS),
existingCxxIt < std::find_if(cm::cbegin(CXX_STANDARDS),
cm::cend(CXX_STANDARDS),
cmStrCmp("11"))) {
setCxx11 = true;
} else if (needCxx98 && existingCxxStandard &&
existingCxxIt < std::find_if(cmArrayBegin(CXX_STANDARDS),
cmArrayEnd(CXX_STANDARDS),
existingCxxIt < std::find_if(cm::cbegin(CXX_STANDARDS),
cm::cend(CXX_STANDARDS),
cmStrCmp("98"))) {
setCxx98 = true;
}
@ -4522,8 +4516,8 @@ bool cmMakefile::AddRequiredTargetCFeature(cmTarget* target,
const char* existingCStandard = target->GetProperty("C_STANDARD");
if (existingCStandard) {
if (std::find_if(cmArrayBegin(C_STANDARDS), cmArrayEnd(C_STANDARDS),
cmStrCmp(existingCStandard)) == cmArrayEnd(C_STANDARDS)) {
if (std::find_if(cm::cbegin(C_STANDARDS), cm::cend(C_STANDARDS),
cmStrCmp(existingCStandard)) == cm::cend(C_STANDARDS)) {
std::ostringstream e;
e << "The C_STANDARD property on target \"" << target->GetName()
<< "\" contained an invalid value: \"" << existingCStandard << "\".";
@ -4537,26 +4531,26 @@ bool cmMakefile::AddRequiredTargetCFeature(cmTarget* target,
}
}
const char* const* existingCIt = existingCStandard
? std::find_if(cmArrayBegin(C_STANDARDS), cmArrayEnd(C_STANDARDS),
? std::find_if(cm::cbegin(C_STANDARDS), cm::cend(C_STANDARDS),
cmStrCmp(existingCStandard))
: cmArrayEnd(C_STANDARDS);
: cm::cend(C_STANDARDS);
bool setC90 = needC90 && !existingCStandard;
bool setC99 = needC99 && !existingCStandard;
bool setC11 = needC11 && !existingCStandard;
if (needC11 && existingCStandard &&
existingCIt < std::find_if(cmArrayBegin(C_STANDARDS),
cmArrayEnd(C_STANDARDS), cmStrCmp("11"))) {
existingCIt < std::find_if(cm::cbegin(C_STANDARDS),
cm::cend(C_STANDARDS), cmStrCmp("11"))) {
setC11 = true;
} else if (needC99 && existingCStandard &&
existingCIt < std::find_if(cmArrayBegin(C_STANDARDS),
cmArrayEnd(C_STANDARDS),
existingCIt < std::find_if(cm::cbegin(C_STANDARDS),
cm::cend(C_STANDARDS),
cmStrCmp("99"))) {
setC99 = true;
} else if (needC90 && existingCStandard &&
existingCIt < std::find_if(cmArrayBegin(C_STANDARDS),
cmArrayEnd(C_STANDARDS),
existingCIt < std::find_if(cm::cbegin(C_STANDARDS),
cm::cend(C_STANDARDS),
cmStrCmp("90"))) {
setC90 = true;
}

View File

@ -9,6 +9,7 @@
#include "cmsys/RegularExpression.hxx"
#include <algorithm>
#include <iterator>
#include <sstream>
#include <stddef.h>
@ -301,8 +302,7 @@ std::string cmQtAutoGen::Quoted(std::string const& text)
"\r", "\\r", "\t", "\\t", "\v", "\\v" };
std::string res = text;
for (const char* const* it = cmArrayBegin(rep); it != cmArrayEnd(rep);
it += 2) {
for (const char* const* it = cm::cbegin(rep); it != cm::cend(rep); it += 2) {
cmSystemTools::ReplaceString(res, *it, *(it + 1));
}
res = '"' + res;

View File

@ -15,6 +15,7 @@
#include "cmVisualStudioGeneratorOptions.h"
#include "windows.h"
#include <iterator>
#include <memory> // IWYU pragma: keep
static std::string cmVS10EscapeXML(std::string arg)
@ -2368,14 +2369,14 @@ bool cmVisualStudio10TargetGenerator::ComputeClOptions(
// Choose a language whose flags to use for ClCompile.
static const char* clLangs[] = { "CXX", "C", "Fortran", "CSharp" };
std::string langForClCompile;
if (std::find(cmArrayBegin(clLangs), cmArrayEnd(clLangs), linkLanguage) !=
cmArrayEnd(clLangs)) {
if (std::find(cm::cbegin(clLangs), cm::cend(clLangs), linkLanguage) !=
cm::cend(clLangs)) {
langForClCompile = linkLanguage;
} else {
std::set<std::string> languages;
this->GeneratorTarget->GetLanguages(languages, configName);
for (const char* const* l = cmArrayBegin(clLangs);
l != cmArrayEnd(clLangs); ++l) {
for (const char* const* l = cm::cbegin(clLangs); l != cm::cend(clLangs);
++l) {
if (languages.find(*l) != languages.end()) {
langForClCompile = *l;
break;

View File

@ -110,6 +110,7 @@
#include "cmsys/RegularExpression.hxx"
#include <algorithm>
#include <iostream>
#include <iterator>
#include <memory> // IWYU pragma: keep
#include <sstream>
#include <stdio.h>
@ -1453,12 +1454,12 @@ void cmake::CreateDefaultGlobalGenerator()
if (vsSetupAPIHelper.IsVS2017Installed()) {
found = "Visual Studio 15 2017";
} else {
for (VSVersionedGenerator const* g = cmArrayBegin(vsGenerators);
found.empty() && g != cmArrayEnd(vsGenerators); ++g) {
for (const char* const* v = cmArrayBegin(vsVariants);
found.empty() && v != cmArrayEnd(vsVariants); ++v) {
for (const char* const* e = cmArrayBegin(vsEntries);
found.empty() && e != cmArrayEnd(vsEntries); ++e) {
for (VSVersionedGenerator const* g = cm::cbegin(vsGenerators);
found.empty() && g != cm::cend(vsGenerators); ++g) {
for (const char* const* v = cm::cbegin(vsVariants);
found.empty() && v != cm::cend(vsVariants); ++v) {
for (const char* const* e = cm::cbegin(vsEntries);
found.empty() && e != cm::cend(vsEntries); ++e) {
std::string const reg = vsregBase + *v + g->MSVersion + *e;
std::string dir;
if (cmSystemTools::ReadRegistryValue(reg, dir,
@ -1716,8 +1717,8 @@ bool cmake::LoadCache(const std::string& path, bool internal,
bool result = this->State->LoadCache(path, internal, excludes, includes);
static const char* entries[] = { "CMAKE_CACHE_MAJOR_VERSION",
"CMAKE_CACHE_MINOR_VERSION" };
for (const char* const* nameIt = cmArrayBegin(entries);
nameIt != cmArrayEnd(entries); ++nameIt) {
for (const char* const* nameIt = cm::cbegin(entries);
nameIt != cm::cend(entries); ++nameIt) {
this->UnwatchUnusedCli(*nameIt);
}
return result;
@ -1730,8 +1731,8 @@ bool cmake::SaveCache(const std::string& path)
"CMAKE_CACHE_MINOR_VERSION",
"CMAKE_CACHE_PATCH_VERSION",
"CMAKE_CACHEFILE_DIR" };
for (const char* const* nameIt = cmArrayBegin(entries);
nameIt != cmArrayEnd(entries); ++nameIt) {
for (const char* const* nameIt = cm::cbegin(entries);
nameIt != cm::cend(entries); ++nameIt) {
this->UnwatchUnusedCli(*nameIt);
}
return result;

View File

@ -35,6 +35,7 @@
#include <algorithm>
#include <functional>
#include <iostream>
#include <iterator>
#include <map>
#include <memory> // IWYU pragma: keep
#include <sstream>
@ -1013,8 +1014,8 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args)
} else if (cmHasLiteralPrefix(arg, "--format=")) {
format = arg.substr(9);
bool isKnown =
std::find(cmArrayBegin(knownFormats), cmArrayEnd(knownFormats),
format) != cmArrayEnd(knownFormats);
std::find(cm::cbegin(knownFormats), cm::cend(knownFormats),
format) != cm::cend(knownFormats);
if (!isKnown) {
cmSystemTools::Error("Unknown -E tar --format= argument: ",