summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
Diffstat (limited to 'Source')
-rw-r--r--Source/CMakeVersion.cmake4
-rw-r--r--Source/cmComputeLinkDepends.cxx2
-rw-r--r--Source/cmGeneratorTarget.h2
-rw-r--r--Source/cmLinkItem.h2
-rw-r--r--Source/cmListCommand.cxx109
-rw-r--r--Source/cmListCommand.h6
-rw-r--r--Source/cmakemain.cxx14
7 files changed, 133 insertions, 6 deletions
diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake
index d3b2ff5..66a97c7 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 4)
-set(CMake_VERSION_PATCH 20160202)
+set(CMake_VERSION_MINOR 5)
+set(CMake_VERSION_PATCH 20160208)
#set(CMake_VERSION_RC 1)
diff --git a/Source/cmComputeLinkDepends.cxx b/Source/cmComputeLinkDepends.cxx
index 13098ad..2796fdf 100644
--- a/Source/cmComputeLinkDepends.cxx
+++ b/Source/cmComputeLinkDepends.cxx
@@ -931,7 +931,7 @@ cmComputeLinkDepends::MakePendingComponent(unsigned int component)
//----------------------------------------------------------------------------
int cmComputeLinkDepends::ComputeComponentCount(NodeList const& nl)
{
- int count = 2;
+ unsigned int count = 2;
for(NodeList::const_iterator ni = nl.begin(); ni != nl.end(); ++ni)
{
if(cmGeneratorTarget const* target = this->EntryList[*ni].Target)
diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h
index d96a32c..65c29f5 100644
--- a/Source/cmGeneratorTarget.h
+++ b/Source/cmGeneratorTarget.h
@@ -599,7 +599,7 @@ private:
{
ImportInfo(): NoSOName(false), Multiplicity(0) {}
bool NoSOName;
- int Multiplicity;
+ unsigned int Multiplicity;
std::string Location;
std::string SOName;
std::string ImportLibrary;
diff --git a/Source/cmLinkItem.h b/Source/cmLinkItem.h
index b603bcc..561293e 100644
--- a/Source/cmLinkItem.h
+++ b/Source/cmLinkItem.h
@@ -73,7 +73,7 @@ struct cmLinkInterface: public cmLinkInterfaceLibraries
// Number of repetitions of a strongly connected component of two
// or more static libraries.
- int Multiplicity;
+ unsigned int Multiplicity;
// Libraries listed for other configurations.
// Needed only for OLD behavior of CMP0003.
diff --git a/Source/cmListCommand.cxx b/Source/cmListCommand.cxx
index 6041fb7..15a1af5 100644
--- a/Source/cmListCommand.cxx
+++ b/Source/cmListCommand.cxx
@@ -14,6 +14,7 @@
#include <cmsys/SystemTools.hxx>
#include "cmAlgorithms.h"
+#include <algorithm>
#include <stdlib.h> // required for atoi
#include <ctype.h>
#include <assert.h>
@@ -68,6 +69,10 @@ bool cmListCommand
{
return this->HandleReverseCommand(args);
}
+ if(subCommand == "FILTER")
+ {
+ return this->HandleFilterCommand(args);
+ }
std::string e = "does not recognize sub-command "+subCommand;
this->SetError(e);
@@ -517,3 +522,107 @@ bool cmListCommand::HandleRemoveAtCommand(
return true;
}
+//----------------------------------------------------------------------------
+bool cmListCommand::HandleFilterCommand(
+ std::vector<std::string> const& args)
+{
+ if(args.size() < 2)
+ {
+ this->SetError("sub-command FILTER requires a list to be specified.");
+ return false;
+ }
+
+ if(args.size() < 3)
+ {
+ this->SetError("sub-command FILTER requires an operator to be specified.");
+ return false;
+ }
+
+ if(args.size() < 4)
+ {
+ this->SetError("sub-command FILTER requires a mode to be specified.");
+ return false;
+ }
+
+ const std::string& listName = args[1];
+ // expand the variable
+ std::vector<std::string> varArgsExpanded;
+ if ( !this->GetList(varArgsExpanded, listName) )
+ {
+ this->SetError("sub-command FILTER requires list to be present.");
+ return false;
+ }
+
+ const std::string& op = args[2];
+ bool includeMatches;
+ if(op == "INCLUDE")
+ {
+ includeMatches = true;
+ }
+ else if(op == "EXCLUDE")
+ {
+ includeMatches = false;
+ }
+ else
+ {
+ this->SetError("sub-command FILTER does not recognize operator " + op);
+ return false;
+ }
+
+ const std::string& mode = args[3];
+ if(mode == "REGEX")
+ {
+ if(args.size() != 5)
+ {
+ this->SetError("sub-command FILTER, mode REGEX "
+ "requires five arguments.");
+ return false;
+ }
+ return this->FilterRegex(args, includeMatches, listName, varArgsExpanded);
+ }
+
+ this->SetError("sub-command FILTER does not recognize mode " + mode);
+ return false;
+}
+
+//----------------------------------------------------------------------------
+class MatchesRegex {
+public:
+ MatchesRegex(cmsys::RegularExpression& in_regex, bool in_includeMatches)
+ : regex(in_regex), includeMatches(in_includeMatches) {}
+
+ bool operator()(const std::string& target) {
+ return regex.find(target) ^ includeMatches;
+ }
+
+private:
+ cmsys::RegularExpression& regex;
+ const bool includeMatches;
+};
+
+bool cmListCommand::FilterRegex(std::vector<std::string> const& args,
+ bool includeMatches,
+ std::string const& listName,
+ std::vector<std::string>& varArgsExpanded)
+{
+ const std::string& pattern = args[4];
+ cmsys::RegularExpression regex(pattern);
+ if(!regex.is_valid())
+ {
+ std::string error = "sub-command FILTER, mode REGEX ";
+ error += "failed to compile regex \"";
+ error += pattern;
+ error += "\".";
+ this->SetError(error);
+ return false;
+ }
+
+ std::vector<std::string>::iterator argsBegin = varArgsExpanded.begin();
+ std::vector<std::string>::iterator argsEnd = varArgsExpanded.end();
+ std::vector<std::string>::iterator newArgsEnd =
+ std::remove_if(argsBegin, argsEnd, MatchesRegex(regex, includeMatches));
+
+ std::string value = cmJoin(cmMakeRange(argsBegin, newArgsEnd), ";");
+ this->Makefile->AddDefinition(listName, value.c_str());
+ return true;
+}
diff --git a/Source/cmListCommand.h b/Source/cmListCommand.h
index 5ea1d9f..25edee8 100644
--- a/Source/cmListCommand.h
+++ b/Source/cmListCommand.h
@@ -58,6 +58,12 @@ protected:
bool HandleRemoveDuplicatesCommand(std::vector<std::string> const& args);
bool HandleSortCommand(std::vector<std::string> const& args);
bool HandleReverseCommand(std::vector<std::string> const& args);
+ bool HandleFilterCommand(std::vector<std::string> const& args);
+ bool FilterRegex(std::vector<std::string> const& args,
+ bool includeMatches,
+ std::string const& listName,
+ std::vector<std::string>& varArgsExpanded
+ );
bool GetList(std::vector<std::string>& list, const std::string& var);
diff --git a/Source/cmakemain.cxx b/Source/cmakemain.cxx
index a06b26f..c60b962 100644
--- a/Source/cmakemain.cxx
+++ b/Source/cmakemain.cxx
@@ -60,6 +60,7 @@ static const char * cmDocumentationUsageNote[][2] =
#define CMAKE_BUILD_OPTIONS \
" <dir> = Project binary directory to be built.\n" \
" --target <tgt> = Build <tgt> instead of default targets.\n" \
+ " May only be specified once.\n" \
" --config <cfg> = For multi-configuration tools, choose <cfg>.\n" \
" --clean-first = Build target 'clean' first, then build.\n" \
" (To clean only, use --target 'clean'.)\n" \
@@ -386,6 +387,7 @@ static int do_build(int ac, char const* const* av)
std::string dir;
std::vector<std::string> nativeOptions;
bool clean = false;
+ bool hasTarget = false;
enum Doing { DoingNone, DoingDir, DoingTarget, DoingConfig, DoingNative};
Doing doing = DoingDir;
@@ -397,7 +399,17 @@ static int do_build(int ac, char const* const* av)
}
else if(strcmp(av[i], "--target") == 0)
{
- doing = DoingTarget;
+ if (!hasTarget)
+ {
+ doing = DoingTarget;
+ hasTarget = true;
+ }
+ else
+ {
+ std::cerr << "'--target' may not be specified more than once.\n\n";
+ dir = "";
+ break;
+ }
}
else if(strcmp(av[i], "--config") == 0)
{