summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
Diffstat (limited to 'Source')
-rw-r--r--Source/CMakeVersion.cmake2
-rw-r--r--Source/cmAddCompileOptionsCommand.cxx2
-rw-r--r--Source/cmAddCustomTargetCommand.cxx2
-rw-r--r--Source/cmAddDefinitionsCommand.cxx2
-rw-r--r--Source/cmAddLibraryCommand.cxx2
-rw-r--r--Source/cmAddSubDirectoryCommand.cxx2
-rw-r--r--Source/cmBuildCommand.cxx2
-rw-r--r--Source/cmBuildNameCommand.cxx2
-rw-r--r--Source/cmCMakePolicyCommand.cxx2
-rw-r--r--Source/cmConditionEvaluator.cxx2
-rw-r--r--Source/cmDefinePropertyCommand.cxx2
-rw-r--r--Source/cmEnableLanguageCommand.cxx2
-rw-r--r--Source/cmExecProgramCommand.cxx2
-rw-r--r--Source/cmExecuteProcessCommand.cxx2
-rw-r--r--Source/cmExportBuildAndroidMKGenerator.cxx2
-rw-r--r--Source/cmExportInstallAndroidMKGenerator.cxx4
-rw-r--r--Source/cmExportLibraryDependenciesCommand.cxx2
-rw-r--r--Source/cmFileCommand.cxx36
-rw-r--r--Source/cmFindPackageCommand.cxx120
-rw-r--r--Source/cmFindPackageCommand.h26
-rw-r--r--Source/cmForEachCommand.cxx2
-rw-r--r--Source/cmFunctionCommand.cxx2
-rw-r--r--Source/cmGeneratorTarget.cxx23
-rw-r--r--Source/cmGlobalGenerator.cxx254
-rw-r--r--Source/cmGlobalGenerator.h29
-rw-r--r--Source/cmIncludeCommand.cxx2
-rw-r--r--Source/cmIncludeDirectoryCommand.cxx2
-rw-r--r--Source/cmIncludeRegularExpressionCommand.cxx2
-rw-r--r--Source/cmLinkDirectoriesCommand.cxx2
-rw-r--r--Source/cmLinkLibrariesCommand.cxx2
-rw-r--r--Source/cmLinkedTree.h4
-rw-r--r--Source/cmLoadCacheCommand.cxx2
-rw-r--r--Source/cmLoadCommandCommand.cxx2
-rw-r--r--Source/cmMacroCommand.cxx2
-rw-r--r--Source/cmMarkAsAdvancedCommand.cxx2
-rw-r--r--Source/cmMathCommand.cxx2
-rw-r--r--Source/cmMessageCommand.cxx2
-rw-r--r--Source/cmProjectCommand.cxx2
-rw-r--r--Source/cmRemoveCommand.cxx2
-rw-r--r--Source/cmRemoveDefinitionsCommand.cxx2
-rw-r--r--Source/cmSetCommand.cxx2
-rw-r--r--Source/cmSetDirectoryPropertiesCommand.cxx2
-rw-r--r--Source/cmSetTestsPropertiesCommand.cxx2
-rw-r--r--Source/cmSourceGroupCommand.cxx2
-rw-r--r--Source/cmStringCommand.cxx2
-rw-r--r--Source/cmSubdirCommand.cxx2
-rw-r--r--Source/cmTarget.cxx23
-rw-r--r--Source/cmTarget.h5
-rw-r--r--Source/cmTargetLinkLibrariesCommand.cxx2
-rw-r--r--Source/cmUnsetCommand.cxx2
-rw-r--r--Source/cmVariableWatchCommand.cxx2
-rw-r--r--Source/cmWhileCommand.cxx2
52 files changed, 390 insertions, 218 deletions
diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake
index 09f55fa..dcce5e4 100644
--- a/Source/CMakeVersion.cmake
+++ b/Source/CMakeVersion.cmake
@@ -1,5 +1,5 @@
# CMake version number components.
set(CMake_VERSION_MAJOR 3)
set(CMake_VERSION_MINOR 6)
-set(CMake_VERSION_PATCH 20160916)
+set(CMake_VERSION_PATCH 20160919)
#set(CMake_VERSION_RC 1)
diff --git a/Source/cmAddCompileOptionsCommand.cxx b/Source/cmAddCompileOptionsCommand.cxx
index 2223cf4..cbba831 100644
--- a/Source/cmAddCompileOptionsCommand.cxx
+++ b/Source/cmAddCompileOptionsCommand.cxx
@@ -14,7 +14,7 @@
bool cmAddCompileOptionsCommand::InitialPass(
std::vector<std::string> const& args, cmExecutionStatus&)
{
- if (args.size() < 1) {
+ if (args.empty()) {
return true;
}
diff --git a/Source/cmAddCustomTargetCommand.cxx b/Source/cmAddCustomTargetCommand.cxx
index 9dc7c59..8e14966 100644
--- a/Source/cmAddCustomTargetCommand.cxx
+++ b/Source/cmAddCustomTargetCommand.cxx
@@ -18,7 +18,7 @@
bool cmAddCustomTargetCommand::InitialPass(
std::vector<std::string> const& args, cmExecutionStatus&)
{
- if (args.size() < 1) {
+ if (args.empty()) {
this->SetError("called with incorrect number of arguments");
return false;
}
diff --git a/Source/cmAddDefinitionsCommand.cxx b/Source/cmAddDefinitionsCommand.cxx
index 2d0d026..5f2b32f 100644
--- a/Source/cmAddDefinitionsCommand.cxx
+++ b/Source/cmAddDefinitionsCommand.cxx
@@ -16,7 +16,7 @@ bool cmAddDefinitionsCommand::InitialPass(std::vector<std::string> const& args,
cmExecutionStatus&)
{
// it is OK to have no arguments
- if (args.size() < 1) {
+ if (args.empty()) {
return true;
}
diff --git a/Source/cmAddLibraryCommand.cxx b/Source/cmAddLibraryCommand.cxx
index 4516ed2..5a40050 100644
--- a/Source/cmAddLibraryCommand.cxx
+++ b/Source/cmAddLibraryCommand.cxx
@@ -18,7 +18,7 @@
bool cmAddLibraryCommand::InitialPass(std::vector<std::string> const& args,
cmExecutionStatus&)
{
- if (args.size() < 1) {
+ if (args.empty()) {
this->SetError("called with incorrect number of arguments");
return false;
}
diff --git a/Source/cmAddSubDirectoryCommand.cxx b/Source/cmAddSubDirectoryCommand.cxx
index 63a9051..1a781cc 100644
--- a/Source/cmAddSubDirectoryCommand.cxx
+++ b/Source/cmAddSubDirectoryCommand.cxx
@@ -15,7 +15,7 @@
bool cmAddSubDirectoryCommand::InitialPass(
std::vector<std::string> const& args, cmExecutionStatus&)
{
- if (args.size() < 1) {
+ if (args.empty()) {
this->SetError("called with incorrect number of arguments");
return false;
}
diff --git a/Source/cmBuildCommand.cxx b/Source/cmBuildCommand.cxx
index 9830867..6146053 100644
--- a/Source/cmBuildCommand.cxx
+++ b/Source/cmBuildCommand.cxx
@@ -27,7 +27,7 @@ bool cmBuildCommand::InitialPass(std::vector<std::string> const& args,
bool cmBuildCommand::MainSignature(std::vector<std::string> const& args)
{
- if (args.size() < 1) {
+ if (args.empty()) {
this->SetError("requires at least one argument naming a CMake variable");
return false;
}
diff --git a/Source/cmBuildNameCommand.cxx b/Source/cmBuildNameCommand.cxx
index 27234d7..3d02034 100644
--- a/Source/cmBuildNameCommand.cxx
+++ b/Source/cmBuildNameCommand.cxx
@@ -22,7 +22,7 @@ bool cmBuildNameCommand::InitialPass(std::vector<std::string> const& args,
"The build_name command should not be called; see CMP0036.")) {
return true;
}
- if (args.size() < 1) {
+ if (args.empty()) {
this->SetError("called with incorrect number of arguments");
return false;
}
diff --git a/Source/cmCMakePolicyCommand.cxx b/Source/cmCMakePolicyCommand.cxx
index 07e0885..03c4a37 100644
--- a/Source/cmCMakePolicyCommand.cxx
+++ b/Source/cmCMakePolicyCommand.cxx
@@ -17,7 +17,7 @@
bool cmCMakePolicyCommand::InitialPass(std::vector<std::string> const& args,
cmExecutionStatus&)
{
- if (args.size() < 1) {
+ if (args.empty()) {
this->SetError("requires at least one argument.");
return false;
}
diff --git a/Source/cmConditionEvaluator.cxx b/Source/cmConditionEvaluator.cxx
index 94f03e8..e670dc6 100644
--- a/Source/cmConditionEvaluator.cxx
+++ b/Source/cmConditionEvaluator.cxx
@@ -85,7 +85,7 @@ bool cmConditionEvaluator::IsTrue(
errorString = "";
// handle empty invocation
- if (args.size() < 1) {
+ if (args.empty()) {
return false;
}
diff --git a/Source/cmDefinePropertyCommand.cxx b/Source/cmDefinePropertyCommand.cxx
index 484a970..3589529 100644
--- a/Source/cmDefinePropertyCommand.cxx
+++ b/Source/cmDefinePropertyCommand.cxx
@@ -17,7 +17,7 @@
bool cmDefinePropertyCommand::InitialPass(std::vector<std::string> const& args,
cmExecutionStatus&)
{
- if (args.size() < 1) {
+ if (args.empty()) {
this->SetError("called with incorrect number of arguments");
return false;
}
diff --git a/Source/cmEnableLanguageCommand.cxx b/Source/cmEnableLanguageCommand.cxx
index 0ebe778..9b7dd03 100644
--- a/Source/cmEnableLanguageCommand.cxx
+++ b/Source/cmEnableLanguageCommand.cxx
@@ -17,7 +17,7 @@ bool cmEnableLanguageCommand::InitialPass(std::vector<std::string> const& args,
{
bool optional = false;
std::vector<std::string> languages;
- if (args.size() < 1) {
+ if (args.empty()) {
this->SetError("called with incorrect number of arguments");
return false;
}
diff --git a/Source/cmExecProgramCommand.cxx b/Source/cmExecProgramCommand.cxx
index 58bbc31..284f486 100644
--- a/Source/cmExecProgramCommand.cxx
+++ b/Source/cmExecProgramCommand.cxx
@@ -19,7 +19,7 @@
bool cmExecProgramCommand::InitialPass(std::vector<std::string> const& args,
cmExecutionStatus&)
{
- if (args.size() < 1) {
+ if (args.empty()) {
this->SetError("called with incorrect number of arguments");
return false;
}
diff --git a/Source/cmExecuteProcessCommand.cxx b/Source/cmExecuteProcessCommand.cxx
index d97b25f..81d8a1f 100644
--- a/Source/cmExecuteProcessCommand.cxx
+++ b/Source/cmExecuteProcessCommand.cxx
@@ -31,7 +31,7 @@ void cmExecuteProcessCommandAppend(std::vector<char>& output, const char* data,
bool cmExecuteProcessCommand::InitialPass(std::vector<std::string> const& args,
cmExecutionStatus&)
{
- if (args.size() < 1) {
+ if (args.empty()) {
this->SetError("called with incorrect number of arguments");
return false;
}
diff --git a/Source/cmExportBuildAndroidMKGenerator.cxx b/Source/cmExportBuildAndroidMKGenerator.cxx
index 3247cc8..96080a9 100644
--- a/Source/cmExportBuildAndroidMKGenerator.cxx
+++ b/Source/cmExportBuildAndroidMKGenerator.cxx
@@ -69,7 +69,7 @@ void cmExportBuildAndroidMKGenerator::GenerateInterfaceProperties(
const ImportPropertyMap& properties)
{
std::string config = "";
- if (this->Configurations.size()) {
+ if (!this->Configurations.empty()) {
config = this->Configurations[0];
}
cmExportBuildAndroidMKGenerator::GenerateInterfaceProperties(
diff --git a/Source/cmExportInstallAndroidMKGenerator.cxx b/Source/cmExportInstallAndroidMKGenerator.cxx
index 8f815b7..10ba6ee 100644
--- a/Source/cmExportInstallAndroidMKGenerator.cxx
+++ b/Source/cmExportInstallAndroidMKGenerator.cxx
@@ -76,7 +76,7 @@ void cmExportInstallAndroidMKGenerator::GenerateImportTargetCode(
os << "LOCAL_SRC_FILES := $(_IMPORT_PREFIX)/";
os << target->Target->GetProperty("__dest") << "/";
std::string config = "";
- if (this->Configurations.size()) {
+ if (!this->Configurations.empty()) {
config = this->Configurations[0];
}
os << target->GetFullName(config) << "\n";
@@ -103,7 +103,7 @@ void cmExportInstallAndroidMKGenerator::GenerateInterfaceProperties(
const ImportPropertyMap& properties)
{
std::string config = "";
- if (this->Configurations.size()) {
+ if (!this->Configurations.empty()) {
config = this->Configurations[0];
}
cmExportBuildAndroidMKGenerator::GenerateInterfaceProperties(
diff --git a/Source/cmExportLibraryDependenciesCommand.cxx b/Source/cmExportLibraryDependenciesCommand.cxx
index b422a2c..d9c30e7 100644
--- a/Source/cmExportLibraryDependenciesCommand.cxx
+++ b/Source/cmExportLibraryDependenciesCommand.cxx
@@ -27,7 +27,7 @@ bool cmExportLibraryDependenciesCommand::InitialPass(
"see CMP0033.")) {
return true;
}
- if (args.size() < 1) {
+ if (args.empty()) {
this->SetError("called with incorrect number of arguments");
return false;
}
diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx
index 2c226cd..c10f426 100644
--- a/Source/cmFileCommand.cxx
+++ b/Source/cmFileCommand.cxx
@@ -2483,6 +2483,8 @@ bool cmFileCommand::HandleDownloadCommand(std::vector<std::string> const& args)
bool showProgress = false;
std::string userpwd;
+ std::list<std::string> curl_headers;
+
while (i != args.end()) {
if (*i == "TIMEOUT") {
++i;
@@ -2572,6 +2574,13 @@ bool cmFileCommand::HandleDownloadCommand(std::vector<std::string> const& args)
return false;
}
userpwd = *i;
+ } else if (*i == "HTTPHEADER") {
+ ++i;
+ if (i == args.end()) {
+ this->SetError("DOWNLOAD missing string for HTTPHEADER.");
+ return false;
+ }
+ curl_headers.push_back(*i);
} else {
// Do not return error for compatibility reason.
std::string err = "Unexpected argument: ";
@@ -2716,8 +2725,17 @@ bool cmFileCommand::HandleDownloadCommand(std::vector<std::string> const& args)
check_curl_result(res, "DOWNLOAD cannot set user password: ");
}
+ struct curl_slist* headers = CM_NULLPTR;
+ for (std::list<std::string>::const_iterator h = curl_headers.begin();
+ h != curl_headers.end(); ++h) {
+ headers = ::curl_slist_append(headers, h->c_str());
+ }
+ ::curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
+
res = ::curl_easy_perform(curl);
+ ::curl_slist_free_all(headers);
+
/* always cleanup */
g_curl.release();
::curl_easy_cleanup(curl);
@@ -2798,6 +2816,8 @@ bool cmFileCommand::HandleUploadCommand(std::vector<std::string> const& args)
bool showProgress = false;
std::string userpwd;
+ std::list<std::string> curl_headers;
+
while (i != args.end()) {
if (*i == "TIMEOUT") {
++i;
@@ -2838,6 +2858,13 @@ bool cmFileCommand::HandleUploadCommand(std::vector<std::string> const& args)
return false;
}
userpwd = *i;
+ } else if (*i == "HTTPHEADER") {
+ ++i;
+ if (i == args.end()) {
+ this->SetError("UPLOAD missing string for HTTPHEADER.");
+ return false;
+ }
+ curl_headers.push_back(*i);
} else {
// Do not return error for compatibility reason.
std::string err = "Unexpected argument: ";
@@ -2956,8 +2983,17 @@ bool cmFileCommand::HandleUploadCommand(std::vector<std::string> const& args)
check_curl_result(res, "UPLOAD cannot set user password: ");
}
+ struct curl_slist* headers = CM_NULLPTR;
+ for (std::list<std::string>::const_iterator h = curl_headers.begin();
+ h != curl_headers.end(); ++h) {
+ headers = ::curl_slist_append(headers, h->c_str());
+ }
+ ::curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
+
res = ::curl_easy_perform(curl);
+ ::curl_slist_free_all(headers);
+
/* always cleanup */
g_curl.release();
::curl_easy_cleanup(curl);
diff --git a/Source/cmFindPackageCommand.cxx b/Source/cmFindPackageCommand.cxx
index 8338c2a..405dce3 100644
--- a/Source/cmFindPackageCommand.cxx
+++ b/Source/cmFindPackageCommand.cxx
@@ -12,6 +12,7 @@
#include "cmFindPackageCommand.h"
#include "cmAlgorithms.h"
+#include <cmSystemTools.h>
#include <cmsys/Directory.hxx>
#include <cmsys/Encoding.hxx>
#include <cmsys/RegularExpression.hxx>
@@ -33,6 +34,45 @@ cmFindPackageCommand::PathLabel cmFindPackageCommand::PathLabel::Builds(
cmFindPackageCommand::PathLabel
cmFindPackageCommand::PathLabel::SystemRegistry("SYSTEM_PACKAGE_REGISTRY");
+struct StrverscmpGreater
+{
+ bool operator()(const std::string& lhs, const std::string& rhs) const
+ {
+ return cmSystemTools::strverscmp(lhs, rhs) > 0;
+ }
+};
+
+struct StrverscmpLesser
+{
+ bool operator()(const std::string& lhs, const std::string& rhs) const
+ {
+ return cmSystemTools::strverscmp(lhs, rhs) < 0;
+ }
+};
+
+void cmFindPackageCommand::Sort(std::vector<std::string>::iterator begin,
+ std::vector<std::string>::iterator end,
+ SortOrderType order, SortDirectionType dir)
+{
+ if (order == Name_order) {
+ if (dir == Dec) {
+ std::sort(begin, end, std::greater<std::string>());
+ } else {
+ std::sort(begin, end);
+ }
+ } else if (order == Natural)
+ // natural order uses letters and numbers (contiguous numbers digit are
+ // compared such that e.g. 000 00 < 01 < 010 < 09 < 0 < 1 < 9 < 10
+ {
+ if (dir == Dec) {
+ std::sort(begin, end, StrverscmpGreater());
+ } else {
+ std::sort(begin, end, StrverscmpLesser());
+ }
+ }
+ // else do not sort
+}
+
cmFindPackageCommand::cmFindPackageCommand()
{
this->CMakePathName = "PACKAGE";
@@ -58,7 +98,8 @@ cmFindPackageCommand::cmFindPackageCommand()
this->VersionFoundTweak = 0;
this->VersionFoundCount = 0;
this->RequiredCMakeVersion = 0;
-
+ this->SortOrder = None;
+ this->SortDirection = Asc;
this->AppendSearchPathGroups();
}
@@ -89,7 +130,7 @@ void cmFindPackageCommand::AppendSearchPathGroups()
bool cmFindPackageCommand::InitialPass(std::vector<std::string> const& args,
cmExecutionStatus&)
{
- if (args.size() < 1) {
+ if (args.empty()) {
this->SetError("called with incorrect number of arguments");
return false;
}
@@ -135,6 +176,23 @@ bool cmFindPackageCommand::InitialPass(std::vector<std::string> const& args,
this->NoSystemRegistry = true;
}
+ // Check if Sorting should be enabled
+ if (const char* so =
+ this->Makefile->GetDefinition("CMAKE_FIND_PACKAGE_SORT_ORDER")) {
+
+ if (strcmp(so, "NAME") == 0) {
+ this->SortOrder = Name_order;
+ } else if (strcmp(so, "NATURAL") == 0) {
+ this->SortOrder = Natural;
+ } else {
+ this->SortOrder = None;
+ }
+ }
+ if (const char* sd =
+ this->Makefile->GetDefinition("CMAKE_FIND_PACKAGE_SORT_DIRECTION")) {
+ this->SortDirection = strcmp(sd, "ASC") == 0 ? Asc : Dec;
+ }
+
// Find the current root path mode.
this->SelectDefaultRootPathMode();
@@ -1666,17 +1724,33 @@ private:
class cmFileListGeneratorProject : public cmFileListGeneratorBase
{
public:
- cmFileListGeneratorProject(std::vector<std::string> const& names)
+ cmFileListGeneratorProject(std::vector<std::string> const& names,
+ cmFindPackageCommand::SortOrderType so,
+ cmFindPackageCommand::SortDirectionType sd)
: cmFileListGeneratorBase()
, Names(names)
{
+ this->SetSort(so, sd);
}
cmFileListGeneratorProject(cmFileListGeneratorProject const& r)
: cmFileListGeneratorBase()
, Names(r.Names)
{
+ this->SetSort(r.SortOrder, r.SortDirection);
+ }
+
+ void SetSort(cmFindPackageCommand::SortOrderType o,
+ cmFindPackageCommand::SortDirectionType d)
+ {
+ SortOrder = o;
+ SortDirection = d;
}
+protected:
+ // sort parameters
+ cmFindPackageCommand::SortOrderType SortOrder;
+ cmFindPackageCommand::SortDirectionType SortDirection;
+
private:
std::vector<std::string> const& Names;
bool Search(std::string const& parent, cmFileList& lister) CM_OVERRIDE
@@ -1698,6 +1772,13 @@ private:
}
}
+ // before testing the matches check if there is a specific sorting order to
+ // perform
+ if (this->SortOrder != cmFindPackageCommand::None) {
+ cmFindPackageCommand::Sort(matches.begin(), matches.end(), SortOrder,
+ SortDirection);
+ }
+
for (std::vector<std::string>::const_iterator i = matches.begin();
i != matches.end(); ++i) {
if (this->Consider(parent + *i, lister)) {
@@ -1895,7 +1976,8 @@ bool cmFindPackageCommand::SearchPrefix(std::string const& prefix_in)
{
cmFindPackageFileList lister(this);
lister / cmFileListGeneratorFixed(prefix) /
- cmFileListGeneratorProject(this->Names);
+ cmFileListGeneratorProject(this->Names, this->SortOrder,
+ this->SortDirection);
if (lister.Search()) {
return true;
}
@@ -1905,7 +1987,8 @@ bool cmFindPackageCommand::SearchPrefix(std::string const& prefix_in)
{
cmFindPackageFileList lister(this);
lister / cmFileListGeneratorFixed(prefix) /
- cmFileListGeneratorProject(this->Names) /
+ cmFileListGeneratorProject(this->Names, this->SortOrder,
+ this->SortDirection) /
cmFileListGeneratorCaseInsensitive("cmake");
if (lister.Search()) {
return true;
@@ -1932,7 +2015,8 @@ bool cmFindPackageCommand::SearchPrefix(std::string const& prefix_in)
lister / cmFileListGeneratorFixed(prefix) /
cmFileListGeneratorEnumerate(common) /
cmFileListGeneratorFixed("cmake") /
- cmFileListGeneratorProject(this->Names);
+ cmFileListGeneratorProject(this->Names, this->SortOrder,
+ this->SortDirection);
if (lister.Search()) {
return true;
}
@@ -1943,7 +2027,8 @@ bool cmFindPackageCommand::SearchPrefix(std::string const& prefix_in)
cmFindPackageFileList lister(this);
lister / cmFileListGeneratorFixed(prefix) /
cmFileListGeneratorEnumerate(common) /
- cmFileListGeneratorProject(this->Names);
+ cmFileListGeneratorProject(this->Names, this->SortOrder,
+ this->SortDirection);
if (lister.Search()) {
return true;
}
@@ -1954,7 +2039,8 @@ bool cmFindPackageCommand::SearchPrefix(std::string const& prefix_in)
cmFindPackageFileList lister(this);
lister / cmFileListGeneratorFixed(prefix) /
cmFileListGeneratorEnumerate(common) /
- cmFileListGeneratorProject(this->Names) /
+ cmFileListGeneratorProject(this->Names, this->SortOrder,
+ this->SortDirection) /
cmFileListGeneratorCaseInsensitive("cmake");
if (lister.Search()) {
return true;
@@ -1965,10 +2051,12 @@ bool cmFindPackageCommand::SearchPrefix(std::string const& prefix_in)
{
cmFindPackageFileList lister(this);
lister / cmFileListGeneratorFixed(prefix) /
- cmFileListGeneratorProject(this->Names) /
+ cmFileListGeneratorProject(this->Names, this->SortOrder,
+ this->SortDirection) /
cmFileListGeneratorEnumerate(common) /
cmFileListGeneratorFixed("cmake") /
- cmFileListGeneratorProject(this->Names);
+ cmFileListGeneratorProject(this->Names, this->SortOrder,
+ this->SortDirection);
if (lister.Search()) {
return true;
}
@@ -1978,9 +2066,11 @@ bool cmFindPackageCommand::SearchPrefix(std::string const& prefix_in)
{
cmFindPackageFileList lister(this);
lister / cmFileListGeneratorFixed(prefix) /
- cmFileListGeneratorProject(this->Names) /
+ cmFileListGeneratorProject(this->Names, this->SortOrder,
+ this->SortDirection) /
cmFileListGeneratorEnumerate(common) /
- cmFileListGeneratorProject(this->Names);
+ cmFileListGeneratorProject(this->Names, this->SortOrder,
+ this->SortDirection);
if (lister.Search()) {
return true;
}
@@ -1990,9 +2080,11 @@ bool cmFindPackageCommand::SearchPrefix(std::string const& prefix_in)
{
cmFindPackageFileList lister(this);
lister / cmFileListGeneratorFixed(prefix) /
- cmFileListGeneratorProject(this->Names) /
+ cmFileListGeneratorProject(this->Names, this->SortOrder,
+ this->SortDirection) /
cmFileListGeneratorEnumerate(common) /
- cmFileListGeneratorProject(this->Names) /
+ cmFileListGeneratorProject(this->Names, this->SortOrder,
+ this->SortDirection) /
cmFileListGeneratorCaseInsensitive("cmake");
if (lister.Search()) {
return true;
diff --git a/Source/cmFindPackageCommand.h b/Source/cmFindPackageCommand.h
index 087107e..babdd5a 100644
--- a/Source/cmFindPackageCommand.h
+++ b/Source/cmFindPackageCommand.h
@@ -24,6 +24,27 @@ class cmFindPackageFileList;
class cmFindPackageCommand : public cmFindCommon
{
public:
+ /*! A sorting order strategy to be applied to recovered package folders (see
+ * FIND_PACKAGE_SORT_ORDER)*/
+ enum /*class*/ SortOrderType
+ {
+ None,
+ Name_order,
+ Natural
+ };
+ /*! A sorting direction to be applied to recovered package folders (see
+ * FIND_PACKAGE_SORT_DIRECTION)*/
+ enum /*class*/ SortDirectionType
+ {
+ Asc,
+ Dec
+ };
+
+ /*! sorts a given list of string based on the input sort parameters */
+ static void Sort(std::vector<std::string>::iterator begin,
+ std::vector<std::string>::iterator end, SortOrderType order,
+ SortDirectionType dir);
+
cmFindPackageCommand();
/**
@@ -156,6 +177,11 @@ private:
std::vector<std::string> Configs;
std::set<std::string> IgnoredPaths;
+ /*! the selected sortOrder (None by default)*/
+ SortOrderType SortOrder;
+ /*! the selected sortDirection (Asc by default)*/
+ SortDirectionType SortDirection;
+
struct ConfigFileInfo
{
std::string filename;
diff --git a/Source/cmForEachCommand.cxx b/Source/cmForEachCommand.cxx
index c6e5f06..dadd080 100644
--- a/Source/cmForEachCommand.cxx
+++ b/Source/cmForEachCommand.cxx
@@ -113,7 +113,7 @@ bool cmForEachFunctionBlocker::ShouldRemove(const cmListFileFunction& lff,
bool cmForEachCommand::InitialPass(std::vector<std::string> const& args,
cmExecutionStatus&)
{
- if (args.size() < 1) {
+ if (args.empty()) {
this->SetError("called with incorrect number of arguments");
return false;
}
diff --git a/Source/cmFunctionCommand.cxx b/Source/cmFunctionCommand.cxx
index 40c54db..bda96aa 100644
--- a/Source/cmFunctionCommand.cxx
+++ b/Source/cmFunctionCommand.cxx
@@ -202,7 +202,7 @@ bool cmFunctionFunctionBlocker::ShouldRemove(const cmListFileFunction& lff,
bool cmFunctionCommand::InitialPass(std::vector<std::string> const& args,
cmExecutionStatus&)
{
- if (args.size() < 1) {
+ if (args.empty()) {
this->SetError("called with incorrect number of arguments");
return false;
}
diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx
index 4f8c036..1e21ac4 100644
--- a/Source/cmGeneratorTarget.cxx
+++ b/Source/cmGeneratorTarget.cxx
@@ -1162,7 +1162,28 @@ bool cmGeneratorTarget::NeedRelinkBeforeInstall(
// If either a build or install tree rpath is set then the rpath
// will likely change between the build tree and install tree and
// this target must be relinked.
- return this->HaveBuildTreeRPATH(config) || this->HaveInstallTreeRPATH();
+ bool have_rpath =
+ this->HaveBuildTreeRPATH(config) || this->HaveInstallTreeRPATH();
+ bool is_ninja =
+ this->LocalGenerator->GetGlobalGenerator()->GetName() == "Ninja";
+
+ if (have_rpath && is_ninja) {
+ std::ostringstream w;
+ /* clang-format off */
+ w <<
+ "The install of the " << this->GetName() << " target requires "
+ "changing an RPATH from the build tree, but this is not supported "
+ "with the Ninja generator unless on an ELF-based platform. The "
+ "CMAKE_BUILD_WITH_INSTALL_RPATH variable may be set to avoid this "
+ "relinking step."
+ ;
+ /* clang-format on */
+
+ cmake* cm = this->LocalGenerator->GetCMakeInstance();
+ cm->IssueMessage(cmake::FATAL_ERROR, w.str(), this->GetBacktrace());
+ }
+
+ return have_rpath;
}
bool cmGeneratorTarget::IsChrpathUsed(const std::string& config) const
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx
index 3d2b60e..ed73450 100644
--- a/Source/cmGlobalGenerator.cxx
+++ b/Source/cmGlobalGenerator.cxx
@@ -1061,16 +1061,16 @@ void cmGlobalGenerator::Configure()
this->ConfigureDoneCMP0026AndCMP0024 = true;
// Put a copy of each global target in every directory.
- cmTargets globalTargets;
- this->CreateDefaultGlobalTargets(&globalTargets);
+ std::vector<GlobalTargetInfo> globalTargets;
+ this->CreateDefaultGlobalTargets(globalTargets);
for (unsigned int i = 0; i < this->Makefiles.size(); ++i) {
cmMakefile* mf = this->Makefiles[i];
cmTargets* targets = &(mf->GetTargets());
- cmTargets::iterator tit;
- for (tit = globalTargets.begin(); tit != globalTargets.end(); ++tit) {
+ for (std::vector<GlobalTargetInfo>::iterator gti = globalTargets.begin();
+ gti != globalTargets.end(); ++gti) {
targets->insert(
- cmTargets::value_type(tit->first, tit->second.CopyForDirectory(mf)));
+ cmTargets::value_type(gti->Name, this->CreateGlobalTarget(*gti, mf)));
}
}
@@ -2070,15 +2070,27 @@ inline std::string removeQuotes(const std::string& s)
return s;
}
-void cmGlobalGenerator::CreateDefaultGlobalTargets(cmTargets* targets)
+void cmGlobalGenerator::CreateDefaultGlobalTargets(
+ std::vector<GlobalTargetInfo>& targets)
+{
+ this->AddGlobalTarget_Package(targets);
+ this->AddGlobalTarget_PackageSource(targets);
+ this->AddGlobalTarget_Test(targets);
+ this->AddGlobalTarget_EditCache(targets);
+ this->AddGlobalTarget_RebuildCache(targets);
+ this->AddGlobalTarget_Install(targets);
+}
+
+void cmGlobalGenerator::AddGlobalTarget_Package(
+ std::vector<GlobalTargetInfo>& targets)
{
cmMakefile* mf = this->Makefiles[0];
const char* cmakeCfgIntDir = this->GetCMakeCFGIntDir();
-
- // CPack
- std::string workingDir = mf->GetCurrentBinaryDirectory();
- cmCustomCommandLines cpackCommandLines;
- std::vector<std::string> depends;
+ GlobalTargetInfo gti;
+ gti.Name = this->GetPackageTargetName();
+ gti.Message = "Run CPack packaging tool...";
+ gti.UsesTerminal = true;
+ gti.WorkingDir = mf->GetCurrentBinaryDirectory();
cmCustomCommandLine singleLine;
singleLine.push_back(cmSystemTools::GetCPackCommand());
if (cmakeCfgIntDir && *cmakeCfgIntDir && cmakeCfgIntDir[0] != '.') {
@@ -2087,60 +2099,61 @@ void cmGlobalGenerator::CreateDefaultGlobalTargets(cmTargets* targets)
}
singleLine.push_back("--config");
std::string configFile = mf->GetCurrentBinaryDirectory();
- ;
configFile += "/CPackConfig.cmake";
std::string relConfigFile = "./CPackConfig.cmake";
singleLine.push_back(relConfigFile);
- cpackCommandLines.push_back(singleLine);
+ gti.CommandLines.push_back(singleLine);
if (this->GetPreinstallTargetName()) {
- depends.push_back(this->GetPreinstallTargetName());
+ gti.Depends.push_back(this->GetPreinstallTargetName());
} else {
const char* noPackageAll =
mf->GetDefinition("CMAKE_SKIP_PACKAGE_ALL_DEPENDENCY");
if (!noPackageAll || cmSystemTools::IsOff(noPackageAll)) {
- depends.push_back(this->GetAllTargetName());
+ gti.Depends.push_back(this->GetAllTargetName());
}
}
if (cmSystemTools::FileExists(configFile.c_str())) {
- targets->insert(cmTargets::value_type(
- this->GetPackageTargetName(),
- this->CreateGlobalTarget(this->GetPackageTargetName(),
- "Run CPack packaging tool...",
- &cpackCommandLines, depends, workingDir.c_str(),
- /*uses_terminal*/ true)));
- }
- // CPack source
+ targets.push_back(gti);
+ }
+}
+
+void cmGlobalGenerator::AddGlobalTarget_PackageSource(
+ std::vector<GlobalTargetInfo>& targets)
+{
+ cmMakefile* mf = this->Makefiles[0];
const char* packageSourceTargetName = this->GetPackageSourceTargetName();
if (packageSourceTargetName) {
- cpackCommandLines.erase(cpackCommandLines.begin(),
- cpackCommandLines.end());
- singleLine.erase(singleLine.begin(), singleLine.end());
- depends.erase(depends.begin(), depends.end());
+ GlobalTargetInfo gti;
+ gti.Name = packageSourceTargetName;
+ gti.Message = "Run CPack packaging tool for source...";
+ gti.WorkingDir = mf->GetCurrentBinaryDirectory();
+ gti.UsesTerminal = true;
+ cmCustomCommandLine singleLine;
singleLine.push_back(cmSystemTools::GetCPackCommand());
singleLine.push_back("--config");
- configFile = mf->GetCurrentBinaryDirectory();
- ;
+ std::string configFile = mf->GetCurrentBinaryDirectory();
configFile += "/CPackSourceConfig.cmake";
- relConfigFile = "./CPackSourceConfig.cmake";
+ std::string relConfigFile = "./CPackSourceConfig.cmake";
singleLine.push_back(relConfigFile);
if (cmSystemTools::FileExists(configFile.c_str())) {
singleLine.push_back(configFile);
- cpackCommandLines.push_back(singleLine);
- targets->insert(cmTargets::value_type(
- packageSourceTargetName,
- this->CreateGlobalTarget(
- packageSourceTargetName, "Run CPack packaging tool for source...",
- &cpackCommandLines, depends, workingDir.c_str(),
- /*uses_terminal*/ true)));
+ gti.CommandLines.push_back(singleLine);
+ targets.push_back(gti);
}
}
+}
- // Test
+void cmGlobalGenerator::AddGlobalTarget_Test(
+ std::vector<GlobalTargetInfo>& targets)
+{
+ cmMakefile* mf = this->Makefiles[0];
+ const char* cmakeCfgIntDir = this->GetCMakeCFGIntDir();
if (mf->IsOn("CMAKE_TESTING_ENABLED")) {
- cpackCommandLines.erase(cpackCommandLines.begin(),
- cpackCommandLines.end());
- singleLine.erase(singleLine.begin(), singleLine.end());
- depends.erase(depends.begin(), depends.end());
+ GlobalTargetInfo gti;
+ gti.Name = this->GetTestTargetName();
+ gti.Message = "Running tests...";
+ gti.UsesTerminal = true;
+ cmCustomCommandLine singleLine;
singleLine.push_back(cmSystemTools::GetCTestCommand());
singleLine.push_back("--force-new-ctest-process");
if (cmakeCfgIntDir && *cmakeCfgIntDir && cmakeCfgIntDir[0] != '.') {
@@ -2151,21 +2164,19 @@ void cmGlobalGenerator::CreateDefaultGlobalTargets(cmTargets* targets)
{
singleLine.push_back("$(ARGS)");
}
- cpackCommandLines.push_back(singleLine);
- targets->insert(cmTargets::value_type(
- this->GetTestTargetName(),
- this->CreateGlobalTarget(this->GetTestTargetName(), "Running tests...",
- &cpackCommandLines, depends, CM_NULLPTR,
- /*uses_terminal*/ true)));
+ gti.CommandLines.push_back(singleLine);
+ targets.push_back(gti);
}
+}
- // Edit Cache
+void cmGlobalGenerator::AddGlobalTarget_EditCache(
+ std::vector<GlobalTargetInfo>& targets)
+{
const char* editCacheTargetName = this->GetEditCacheTargetName();
if (editCacheTargetName) {
- cpackCommandLines.erase(cpackCommandLines.begin(),
- cpackCommandLines.end());
- singleLine.erase(singleLine.begin(), singleLine.end());
- depends.erase(depends.begin(), depends.end());
+ GlobalTargetInfo gti;
+ gti.Name = editCacheTargetName;
+ cmCustomCommandLine singleLine;
// Use generator preference for the edit_cache rule if it is defined.
std::string edit_cmd = this->GetEditCacheCommand();
@@ -2173,45 +2184,46 @@ void cmGlobalGenerator::CreateDefaultGlobalTargets(cmTargets* targets)
singleLine.push_back(edit_cmd);
singleLine.push_back("-H$(CMAKE_SOURCE_DIR)");
singleLine.push_back("-B$(CMAKE_BINARY_DIR)");
- cpackCommandLines.push_back(singleLine);
- targets->insert(cmTargets::value_type(
- editCacheTargetName,
- this->CreateGlobalTarget(
- editCacheTargetName, "Running CMake cache editor...",
- &cpackCommandLines, depends, CM_NULLPTR, /*uses_terminal*/ true)));
+ gti.Message = "Running CMake cache editor...";
+ gti.UsesTerminal = true;
+ gti.CommandLines.push_back(singleLine);
} else {
singleLine.push_back(cmSystemTools::GetCMakeCommand());
singleLine.push_back("-E");
singleLine.push_back("echo");
singleLine.push_back("No interactive CMake dialog available.");
- cpackCommandLines.push_back(singleLine);
- targets->insert(cmTargets::value_type(
- editCacheTargetName,
- this->CreateGlobalTarget(
- editCacheTargetName, "No interactive CMake dialog available...",
- &cpackCommandLines, depends, CM_NULLPTR, /*uses_terminal*/ false)));
+ gti.Message = "No interactive CMake dialog available...";
+ gti.UsesTerminal = false;
+ gti.CommandLines.push_back(singleLine);
}
+
+ targets.push_back(gti);
}
+}
- // Rebuild Cache
+void cmGlobalGenerator::AddGlobalTarget_RebuildCache(
+ std::vector<GlobalTargetInfo>& targets)
+{
const char* rebuildCacheTargetName = this->GetRebuildCacheTargetName();
if (rebuildCacheTargetName) {
- cpackCommandLines.erase(cpackCommandLines.begin(),
- cpackCommandLines.end());
- singleLine.erase(singleLine.begin(), singleLine.end());
- depends.erase(depends.begin(), depends.end());
+ GlobalTargetInfo gti;
+ gti.Name = rebuildCacheTargetName;
+ gti.Message = "Running CMake to regenerate build system...";
+ gti.UsesTerminal = true;
+ cmCustomCommandLine singleLine;
singleLine.push_back(cmSystemTools::GetCMakeCommand());
singleLine.push_back("-H$(CMAKE_SOURCE_DIR)");
singleLine.push_back("-B$(CMAKE_BINARY_DIR)");
- cpackCommandLines.push_back(singleLine);
- targets->insert(cmTargets::value_type(
- rebuildCacheTargetName,
- this->CreateGlobalTarget(
- rebuildCacheTargetName, "Running CMake to regenerate build system...",
- &cpackCommandLines, depends, CM_NULLPTR, /*uses_terminal*/ true)));
+ gti.CommandLines.push_back(singleLine);
+ targets.push_back(gti);
}
+}
- // Install
+void cmGlobalGenerator::AddGlobalTarget_Install(
+ std::vector<GlobalTargetInfo>& targets)
+{
+ cmMakefile* mf = this->Makefiles[0];
+ const char* cmakeCfgIntDir = this->GetCMakeCFGIntDir();
bool skipInstallRules = mf->IsOn("CMAKE_SKIP_INSTALL_RULES");
if (this->InstallTargetEnabled && skipInstallRules) {
this->CMakeInstance->IssueMessage(
@@ -2221,9 +2233,6 @@ void cmGlobalGenerator::CreateDefaultGlobalTargets(cmTargets* targets)
} else if (this->InstallTargetEnabled && !skipInstallRules) {
if (!cmakeCfgIntDir || !*cmakeCfgIntDir || cmakeCfgIntDir[0] == '.') {
std::set<std::string>* componentsSet = &this->InstallComponents;
- cpackCommandLines.erase(cpackCommandLines.begin(),
- cpackCommandLines.end());
- depends.erase(depends.begin(), depends.end());
std::ostringstream ostr;
if (!componentsSet->empty()) {
ostr << "Available install components are: ";
@@ -2231,25 +2240,25 @@ void cmGlobalGenerator::CreateDefaultGlobalTargets(cmTargets* targets)
} else {
ostr << "Only default component available";
}
- singleLine.push_back(ostr.str());
- targets->insert(cmTargets::value_type(
- "list_install_components",
- this->CreateGlobalTarget("list_install_components", ostr.str().c_str(),
- &cpackCommandLines, depends, CM_NULLPTR,
- /*uses_terminal*/ false)));
+ GlobalTargetInfo gti;
+ gti.Name = "list_install_components";
+ gti.Message = ostr.str();
+ gti.UsesTerminal = false;
+ targets.push_back(gti);
}
std::string cmd = cmSystemTools::GetCMakeCommand();
- cpackCommandLines.erase(cpackCommandLines.begin(),
- cpackCommandLines.end());
- singleLine.erase(singleLine.begin(), singleLine.end());
- depends.erase(depends.begin(), depends.end());
+ GlobalTargetInfo gti;
+ gti.Name = this->GetInstallTargetName();
+ gti.Message = "Install the project...";
+ gti.UsesTerminal = true;
+ cmCustomCommandLine singleLine;
if (this->GetPreinstallTargetName()) {
- depends.push_back(this->GetPreinstallTargetName());
+ gti.Depends.push_back(this->GetPreinstallTargetName());
} else {
const char* noall =
mf->GetDefinition("CMAKE_SKIP_INSTALL_ALL_DEPENDENCY");
if (!noall || cmSystemTools::IsOff(noall)) {
- depends.push_back(this->GetAllTargetName());
+ gti.Depends.push_back(this->GetAllTargetName());
}
}
if (mf->GetDefinition("CMake_BINARY_DIR") &&
@@ -2274,46 +2283,39 @@ void cmGlobalGenerator::CreateDefaultGlobalTargets(cmTargets* targets)
}
singleLine.push_back("-P");
singleLine.push_back("cmake_install.cmake");
- cpackCommandLines.push_back(singleLine);
- targets->insert(cmTargets::value_type(
- this->GetInstallTargetName(),
- this->CreateGlobalTarget(this->GetInstallTargetName(),
- "Install the project...", &cpackCommandLines,
- depends, CM_NULLPTR, /*uses_terminal*/ true)));
+ gti.CommandLines.push_back(singleLine);
+ targets.push_back(gti);
// install_local
if (const char* install_local = this->GetInstallLocalTargetName()) {
+ gti.Name = install_local;
+ gti.Message = "Installing only the local directory...";
+ gti.UsesTerminal = true;
+ gti.CommandLines.clear();
+
cmCustomCommandLine localCmdLine = singleLine;
localCmdLine.insert(localCmdLine.begin() + 1,
"-DCMAKE_INSTALL_LOCAL_ONLY=1");
- cpackCommandLines.erase(cpackCommandLines.begin(),
- cpackCommandLines.end());
- cpackCommandLines.push_back(localCmdLine);
- targets->insert(cmTargets::value_type(
- install_local,
- this->CreateGlobalTarget(
- install_local, "Installing only the local directory...",
- &cpackCommandLines, depends, CM_NULLPTR, /*uses_terminal*/ true)));
+ gti.CommandLines.push_back(localCmdLine);
+ targets.push_back(gti);
}
// install_strip
const char* install_strip = this->GetInstallStripTargetName();
if ((install_strip != CM_NULLPTR) && (mf->IsSet("CMAKE_STRIP"))) {
+ gti.Name = install_strip;
+ gti.Message = "Installing the project stripped...";
+ gti.UsesTerminal = true;
+ gti.CommandLines.clear();
+
cmCustomCommandLine stripCmdLine = singleLine;
stripCmdLine.insert(stripCmdLine.begin() + 1,
"-DCMAKE_INSTALL_DO_STRIP=1");
- cpackCommandLines.erase(cpackCommandLines.begin(),
- cpackCommandLines.end());
- cpackCommandLines.push_back(stripCmdLine);
-
- targets->insert(cmTargets::value_type(
- install_strip,
- this->CreateGlobalTarget(
- install_strip, "Installing the project stripped...",
- &cpackCommandLines, depends, CM_NULLPTR, /*uses_terminal*/ true)));
+ gti.CommandLines.push_back(stripCmdLine);
+ targets.push_back(gti);
}
}
}
@@ -2347,14 +2349,12 @@ bool cmGlobalGenerator::UseFolderProperty()
return false;
}
-cmTarget cmGlobalGenerator::CreateGlobalTarget(
- const std::string& name, const char* message,
- const cmCustomCommandLines* commandLines, std::vector<std::string> depends,
- const char* workingDirectory, bool uses_terminal)
+cmTarget cmGlobalGenerator::CreateGlobalTarget(GlobalTargetInfo const& gti,
+ cmMakefile* mf)
{
// Package
- cmTarget target(name, cmState::GLOBAL_TARGET, cmTarget::VisibilityNormal,
- CM_NULLPTR);
+ cmTarget target(gti.Name, cmState::GLOBAL_TARGET, cmTarget::VisibilityNormal,
+ mf);
target.SetProperty("EXCLUDE_FROM_ALL", "TRUE");
std::vector<std::string> no_outputs;
@@ -2362,12 +2362,14 @@ cmTarget cmGlobalGenerator::CreateGlobalTarget(
std::vector<std::string> no_depends;
// Store the custom command in the target.
cmCustomCommand cc(CM_NULLPTR, no_outputs, no_byproducts, no_depends,
- *commandLines, CM_NULLPTR, workingDirectory);
- cc.SetUsesTerminal(uses_terminal);
+ gti.CommandLines, CM_NULLPTR, gti.WorkingDir.c_str());
+ cc.SetUsesTerminal(gti.UsesTerminal);
target.AddPostBuildCommand(cc);
- target.SetProperty("EchoString", message);
- std::vector<std::string>::iterator dit;
- for (dit = depends.begin(); dit != depends.end(); ++dit) {
+ if (!gti.Message.empty()) {
+ target.SetProperty("EchoString", gti.Message.c_str());
+ }
+ for (std::vector<std::string>::const_iterator dit = gti.Depends.begin();
+ dit != gti.Depends.end(); ++dit) {
target.AddUtility(*dit);
}
diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h
index 1e1479a..f7b2e59 100644
--- a/Source/cmGlobalGenerator.h
+++ b/Source/cmGlobalGenerator.h
@@ -402,11 +402,30 @@ protected:
bool IsExcluded(cmLocalGenerator* root, cmLocalGenerator* gen) const;
bool IsExcluded(cmLocalGenerator* root, cmGeneratorTarget* target) const;
virtual void InitializeProgressMarks() {}
- void CreateDefaultGlobalTargets(cmTargets* targets);
- cmTarget CreateGlobalTarget(const std::string& name, const char* message,
- const cmCustomCommandLines* commandLines,
- std::vector<std::string> depends,
- const char* workingDir, bool uses_terminal);
+
+ struct GlobalTargetInfo
+ {
+ std::string Name;
+ std::string Message;
+ cmCustomCommandLines CommandLines;
+ std::vector<std::string> Depends;
+ std::string WorkingDir;
+ bool UsesTerminal;
+ GlobalTargetInfo()
+ : UsesTerminal(false)
+ {
+ }
+ };
+
+ void CreateDefaultGlobalTargets(std::vector<GlobalTargetInfo>& targets);
+
+ void AddGlobalTarget_Package(std::vector<GlobalTargetInfo>& targets);
+ void AddGlobalTarget_PackageSource(std::vector<GlobalTargetInfo>& targets);
+ void AddGlobalTarget_Test(std::vector<GlobalTargetInfo>& targets);
+ void AddGlobalTarget_EditCache(std::vector<GlobalTargetInfo>& targets);
+ void AddGlobalTarget_RebuildCache(std::vector<GlobalTargetInfo>& targets);
+ void AddGlobalTarget_Install(std::vector<GlobalTargetInfo>& targets);
+ cmTarget CreateGlobalTarget(GlobalTargetInfo const& gti, cmMakefile* mf);
std::string FindMakeProgramFile;
std::string ConfiguredFilesPath;
diff --git a/Source/cmIncludeCommand.cxx b/Source/cmIncludeCommand.cxx
index 360ebeb..c90314e 100644
--- a/Source/cmIncludeCommand.cxx
+++ b/Source/cmIncludeCommand.cxx
@@ -15,7 +15,7 @@
bool cmIncludeCommand::InitialPass(std::vector<std::string> const& args,
cmExecutionStatus&)
{
- if (args.size() < 1 || args.size() > 4) {
+ if (args.empty() || args.size() > 4) {
this->SetError("called with wrong number of arguments. "
"include() only takes one file.");
return false;
diff --git a/Source/cmIncludeDirectoryCommand.cxx b/Source/cmIncludeDirectoryCommand.cxx
index cafdba7..904fcca 100644
--- a/Source/cmIncludeDirectoryCommand.cxx
+++ b/Source/cmIncludeDirectoryCommand.cxx
@@ -15,7 +15,7 @@
bool cmIncludeDirectoryCommand::InitialPass(
std::vector<std::string> const& args, cmExecutionStatus&)
{
- if (args.size() < 1) {
+ if (args.empty()) {
return true;
}
diff --git a/Source/cmIncludeRegularExpressionCommand.cxx b/Source/cmIncludeRegularExpressionCommand.cxx
index 2473dff..bd26d93 100644
--- a/Source/cmIncludeRegularExpressionCommand.cxx
+++ b/Source/cmIncludeRegularExpressionCommand.cxx
@@ -15,7 +15,7 @@
bool cmIncludeRegularExpressionCommand::InitialPass(
std::vector<std::string> const& args, cmExecutionStatus&)
{
- if ((args.size() < 1) || (args.size() > 2)) {
+ if ((args.empty()) || (args.size() > 2)) {
this->SetError("called with incorrect number of arguments");
return false;
}
diff --git a/Source/cmLinkDirectoriesCommand.cxx b/Source/cmLinkDirectoriesCommand.cxx
index a33b429..9b5d54a 100644
--- a/Source/cmLinkDirectoriesCommand.cxx
+++ b/Source/cmLinkDirectoriesCommand.cxx
@@ -15,7 +15,7 @@
bool cmLinkDirectoriesCommand::InitialPass(
std::vector<std::string> const& args, cmExecutionStatus&)
{
- if (args.size() < 1) {
+ if (args.empty()) {
return true;
}
diff --git a/Source/cmLinkLibrariesCommand.cxx b/Source/cmLinkLibrariesCommand.cxx
index 5d23d6a..bef234e 100644
--- a/Source/cmLinkLibrariesCommand.cxx
+++ b/Source/cmLinkLibrariesCommand.cxx
@@ -15,7 +15,7 @@
bool cmLinkLibrariesCommand::InitialPass(std::vector<std::string> const& args,
cmExecutionStatus&)
{
- if (args.size() < 1) {
+ if (args.empty()) {
return true;
}
// add libraries, nothe that there is an optional prefix
diff --git a/Source/cmLinkedTree.h b/Source/cmLinkedTree.h
index 466aaa7..025c0a3 100644
--- a/Source/cmLinkedTree.h
+++ b/Source/cmLinkedTree.h
@@ -167,10 +167,10 @@ public:
iterator Truncate()
{
- assert(this->UpPositions.size() > 0);
+ assert(!this->UpPositions.empty());
this->UpPositions.erase(this->UpPositions.begin() + 1,
this->UpPositions.end());
- assert(this->Data.size() > 0);
+ assert(!this->Data.empty());
this->Data.erase(this->Data.begin() + 1, this->Data.end());
return iterator(this, 1);
}
diff --git a/Source/cmLoadCacheCommand.cxx b/Source/cmLoadCacheCommand.cxx
index 85188d1..6d9cf8e 100644
--- a/Source/cmLoadCacheCommand.cxx
+++ b/Source/cmLoadCacheCommand.cxx
@@ -18,7 +18,7 @@
bool cmLoadCacheCommand::InitialPass(std::vector<std::string> const& args,
cmExecutionStatus&)
{
- if (args.size() < 1) {
+ if (args.empty()) {
this->SetError("called with wrong number of arguments.");
}
diff --git a/Source/cmLoadCommandCommand.cxx b/Source/cmLoadCommandCommand.cxx
index ddf6ce6..4d8a4e3 100644
--- a/Source/cmLoadCommandCommand.cxx
+++ b/Source/cmLoadCommandCommand.cxx
@@ -183,7 +183,7 @@ bool cmLoadCommandCommand::InitialPass(std::vector<std::string> const& args,
"The load_command command should not be called; see CMP0031.")) {
return true;
}
- if (args.size() < 1) {
+ if (args.empty()) {
return true;
}
diff --git a/Source/cmMacroCommand.cxx b/Source/cmMacroCommand.cxx
index ee9dc8a..5231062 100644
--- a/Source/cmMacroCommand.cxx
+++ b/Source/cmMacroCommand.cxx
@@ -236,7 +236,7 @@ bool cmMacroFunctionBlocker::ShouldRemove(const cmListFileFunction& lff,
bool cmMacroCommand::InitialPass(std::vector<std::string> const& args,
cmExecutionStatus&)
{
- if (args.size() < 1) {
+ if (args.empty()) {
this->SetError("called with incorrect number of arguments");
return false;
}
diff --git a/Source/cmMarkAsAdvancedCommand.cxx b/Source/cmMarkAsAdvancedCommand.cxx
index 2fb6a75..6c979f6 100644
--- a/Source/cmMarkAsAdvancedCommand.cxx
+++ b/Source/cmMarkAsAdvancedCommand.cxx
@@ -15,7 +15,7 @@
bool cmMarkAsAdvancedCommand::InitialPass(std::vector<std::string> const& args,
cmExecutionStatus&)
{
- if (args.size() < 1) {
+ if (args.empty()) {
this->SetError("called with incorrect number of arguments");
return false;
}
diff --git a/Source/cmMathCommand.cxx b/Source/cmMathCommand.cxx
index ca8b926..b812349 100644
--- a/Source/cmMathCommand.cxx
+++ b/Source/cmMathCommand.cxx
@@ -16,7 +16,7 @@
bool cmMathCommand::InitialPass(std::vector<std::string> const& args,
cmExecutionStatus&)
{
- if (args.size() < 1) {
+ if (args.empty()) {
this->SetError("must be called with at least one argument.");
return false;
}
diff --git a/Source/cmMessageCommand.cxx b/Source/cmMessageCommand.cxx
index c48910e..e884531 100644
--- a/Source/cmMessageCommand.cxx
+++ b/Source/cmMessageCommand.cxx
@@ -17,7 +17,7 @@
bool cmMessageCommand::InitialPass(std::vector<std::string> const& args,
cmExecutionStatus&)
{
- if (args.size() < 1) {
+ if (args.empty()) {
this->SetError("called with incorrect number of arguments");
return false;
}
diff --git a/Source/cmProjectCommand.cxx b/Source/cmProjectCommand.cxx
index 139303b..6f98d94 100644
--- a/Source/cmProjectCommand.cxx
+++ b/Source/cmProjectCommand.cxx
@@ -15,7 +15,7 @@
bool cmProjectCommand::InitialPass(std::vector<std::string> const& args,
cmExecutionStatus&)
{
- if (args.size() < 1) {
+ if (args.empty()) {
this->SetError("PROJECT called with incorrect number of arguments");
return false;
}
diff --git a/Source/cmRemoveCommand.cxx b/Source/cmRemoveCommand.cxx
index 955f712..c695374 100644
--- a/Source/cmRemoveCommand.cxx
+++ b/Source/cmRemoveCommand.cxx
@@ -15,7 +15,7 @@
bool cmRemoveCommand::InitialPass(std::vector<std::string> const& args,
cmExecutionStatus&)
{
- if (args.size() < 1) {
+ if (args.empty()) {
return true;
}
diff --git a/Source/cmRemoveDefinitionsCommand.cxx b/Source/cmRemoveDefinitionsCommand.cxx
index 638eda6..77de846 100644
--- a/Source/cmRemoveDefinitionsCommand.cxx
+++ b/Source/cmRemoveDefinitionsCommand.cxx
@@ -16,7 +16,7 @@ bool cmRemoveDefinitionsCommand::InitialPass(
std::vector<std::string> const& args, cmExecutionStatus&)
{
// it is OK to have no arguments
- if (args.size() < 1) {
+ if (args.empty()) {
return true;
}
diff --git a/Source/cmSetCommand.cxx b/Source/cmSetCommand.cxx
index 8fb6aa0..6bdb28b 100644
--- a/Source/cmSetCommand.cxx
+++ b/Source/cmSetCommand.cxx
@@ -15,7 +15,7 @@
bool cmSetCommand::InitialPass(std::vector<std::string> const& args,
cmExecutionStatus&)
{
- if (args.size() < 1) {
+ if (args.empty()) {
this->SetError("called with incorrect number of arguments");
return false;
}
diff --git a/Source/cmSetDirectoryPropertiesCommand.cxx b/Source/cmSetDirectoryPropertiesCommand.cxx
index ca758da..8584118 100644
--- a/Source/cmSetDirectoryPropertiesCommand.cxx
+++ b/Source/cmSetDirectoryPropertiesCommand.cxx
@@ -17,7 +17,7 @@
bool cmSetDirectoryPropertiesCommand::InitialPass(
std::vector<std::string> const& args, cmExecutionStatus&)
{
- if (args.size() < 1) {
+ if (args.empty()) {
this->SetError("called with incorrect number of arguments");
return false;
}
diff --git a/Source/cmSetTestsPropertiesCommand.cxx b/Source/cmSetTestsPropertiesCommand.cxx
index 2fb137f..59d569d 100644
--- a/Source/cmSetTestsPropertiesCommand.cxx
+++ b/Source/cmSetTestsPropertiesCommand.cxx
@@ -18,7 +18,7 @@
bool cmSetTestsPropertiesCommand::InitialPass(
std::vector<std::string> const& args, cmExecutionStatus&)
{
- if (args.size() < 1) {
+ if (args.empty()) {
this->SetError("called with incorrect number of arguments");
return false;
}
diff --git a/Source/cmSourceGroupCommand.cxx b/Source/cmSourceGroupCommand.cxx
index 6db14c0..6f7ef6c 100644
--- a/Source/cmSourceGroupCommand.cxx
+++ b/Source/cmSourceGroupCommand.cxx
@@ -15,7 +15,7 @@
bool cmSourceGroupCommand::InitialPass(std::vector<std::string> const& args,
cmExecutionStatus&)
{
- if (args.size() < 1) {
+ if (args.empty()) {
this->SetError("called with incorrect number of arguments");
return false;
}
diff --git a/Source/cmStringCommand.cxx b/Source/cmStringCommand.cxx
index 3c913ee..addfed4 100644
--- a/Source/cmStringCommand.cxx
+++ b/Source/cmStringCommand.cxx
@@ -26,7 +26,7 @@
bool cmStringCommand::InitialPass(std::vector<std::string> const& args,
cmExecutionStatus&)
{
- if (args.size() < 1) {
+ if (args.empty()) {
this->SetError("must be called with at least one argument.");
return false;
}
diff --git a/Source/cmSubdirCommand.cxx b/Source/cmSubdirCommand.cxx
index 401f588..4893978 100644
--- a/Source/cmSubdirCommand.cxx
+++ b/Source/cmSubdirCommand.cxx
@@ -15,7 +15,7 @@
bool cmSubdirCommand::InitialPass(std::vector<std::string> const& args,
cmExecutionStatus&)
{
- if (args.size() < 1) {
+ if (args.empty()) {
this->SetError("called with incorrect number of arguments");
return false;
}
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index d964f00..1b6c93e 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -62,10 +62,10 @@ public:
cmTarget::cmTarget(std::string const& name, cmState::TargetType type,
Visibility vis, cmMakefile* mf)
{
- assert(mf || type == cmState::GLOBAL_TARGET);
+ assert(mf);
this->Name = name;
this->TargetTypeValue = type;
- this->Makefile = CM_NULLPTR;
+ this->Makefile = mf;
this->HaveInstallRule = false;
this->DLLPlatform = false;
this->IsAndroid = false;
@@ -82,25 +82,6 @@ cmTarget::cmTarget(std::string const& name, cmState::TargetType type,
this->RecordDependencies = false;
}
- if (mf) {
- this->SetMakefile(mf);
- }
-}
-
-cmTarget cmTarget::CopyForDirectory(cmMakefile* mf) const
-{
- assert(this->GetType() == cmState::GLOBAL_TARGET);
- assert(this->GetMakefile() == CM_NULLPTR);
- cmTarget result(*this);
- result.SetMakefile(mf);
- return result;
-}
-
-void cmTarget::SetMakefile(cmMakefile* mf)
-{
- // Set our makefile.
- this->Makefile = mf;
-
// Check whether this is a DLL platform.
this->DLLPlatform =
(this->Makefile->IsOn("WIN32") || this->Makefile->IsOn("CYGWIN") ||
diff --git a/Source/cmTarget.h b/Source/cmTarget.h
index ebc92f3..4b182bb 100644
--- a/Source/cmTarget.h
+++ b/Source/cmTarget.h
@@ -88,9 +88,6 @@ public:
///! Set/Get the name of the target
const std::string& GetName() const { return this->Name; }
- /** Get a copy of this target adapted for the given directory. */
- cmTarget CopyForDirectory(cmMakefile* mf) const;
-
/** Get the cmMakefile that owns this target. */
cmMakefile* GetMakefile() const { return this->Makefile; }
@@ -283,8 +280,6 @@ public:
};
private:
- void SetMakefile(cmMakefile* mf);
-
bool HandleLocationPropertyPolicy(cmMakefile* context) const;
const char* GetSuffixVariableInternal(bool implib) const;
diff --git a/Source/cmTargetLinkLibrariesCommand.cxx b/Source/cmTargetLinkLibrariesCommand.cxx
index 1c4a9ce..b62e225 100644
--- a/Source/cmTargetLinkLibrariesCommand.cxx
+++ b/Source/cmTargetLinkLibrariesCommand.cxx
@@ -22,7 +22,7 @@ bool cmTargetLinkLibrariesCommand::InitialPass(
std::vector<std::string> const& args, cmExecutionStatus&)
{
// must have one argument
- if (args.size() < 1) {
+ if (args.empty()) {
this->SetError("called with incorrect number of arguments");
return false;
}
diff --git a/Source/cmUnsetCommand.cxx b/Source/cmUnsetCommand.cxx
index 05ba65a..5bf137c 100644
--- a/Source/cmUnsetCommand.cxx
+++ b/Source/cmUnsetCommand.cxx
@@ -15,7 +15,7 @@
bool cmUnsetCommand::InitialPass(std::vector<std::string> const& args,
cmExecutionStatus&)
{
- if (args.size() < 1 || args.size() > 2) {
+ if (args.empty() || args.size() > 2) {
this->SetError("called with incorrect number of arguments");
return false;
}
diff --git a/Source/cmVariableWatchCommand.cxx b/Source/cmVariableWatchCommand.cxx
index f30ffe8..cf740db 100644
--- a/Source/cmVariableWatchCommand.cxx
+++ b/Source/cmVariableWatchCommand.cxx
@@ -104,7 +104,7 @@ cmVariableWatchCommand::~cmVariableWatchCommand()
bool cmVariableWatchCommand::InitialPass(std::vector<std::string> const& args,
cmExecutionStatus&)
{
- if (args.size() < 1) {
+ if (args.empty()) {
this->SetError("must be called with at least one argument.");
return false;
}
diff --git a/Source/cmWhileCommand.cxx b/Source/cmWhileCommand.cxx
index 93a6271..ad558fe 100644
--- a/Source/cmWhileCommand.cxx
+++ b/Source/cmWhileCommand.cxx
@@ -133,7 +133,7 @@ bool cmWhileFunctionBlocker::ShouldRemove(const cmListFileFunction& lff,
bool cmWhileCommand::InvokeInitialPass(
const std::vector<cmListFileArgument>& args, cmExecutionStatus&)
{
- if (args.size() < 1) {
+ if (args.empty()) {
this->SetError("called with incorrect number of arguments");
return false;
}