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/cmCurl.cxx5
-rw-r--r--Source/cmGeneratorTarget.h2
-rw-r--r--Source/cmGlobalGenerator.cxx81
-rw-r--r--Source/cmGlobalGenerator.h24
-rw-r--r--Source/cmInstallCommand.cxx39
-rw-r--r--Source/cmInstallCommandArguments.cxx30
-rw-r--r--Source/cmInstallCommandArguments.h2
-rw-r--r--Source/cmInstallDirectoryGenerator.cxx4
-rw-r--r--Source/cmInstallDirectoryGenerator.h1
-rw-r--r--Source/cmInstallExportGenerator.cxx4
-rw-r--r--Source/cmInstallExportGenerator.h1
-rw-r--r--Source/cmInstallFilesCommand.cxx4
-rw-r--r--Source/cmInstallFilesGenerator.cxx4
-rw-r--r--Source/cmInstallFilesGenerator.h1
-rw-r--r--Source/cmInstallGenerator.cxx18
-rw-r--r--Source/cmInstallGenerator.h7
-rw-r--r--Source/cmInstallProgramsCommand.cxx4
-rw-r--r--Source/cmInstallScriptGenerator.cxx7
-rw-r--r--Source/cmInstallScriptGenerator.h2
-rw-r--r--Source/cmInstallTargetGenerator.cxx4
-rw-r--r--Source/cmInstallTargetGenerator.h1
-rw-r--r--Source/cmLinkItem.h2
-rw-r--r--Source/cmListCommand.cxx109
-rw-r--r--Source/cmListCommand.h6
-rw-r--r--Source/cmListFileCache.h3
-rw-r--r--Source/cmLocalGenerator.cxx8
-rw-r--r--Source/cmMakefile.cxx2
-rw-r--r--Source/cmakemain.cxx14
-rw-r--r--Source/cmcmd.cxx6
31 files changed, 292 insertions, 109 deletions
diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake
index d3b2ff5..d81477a 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 20160216)
#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/cmCurl.cxx b/Source/cmCurl.cxx
index ad0c7d3..4f3d890 100644
--- a/Source/cmCurl.cxx
+++ b/Source/cmCurl.cxx
@@ -12,6 +12,11 @@
#include "cmCurl.h"
#include "cmSystemTools.h"
+// curl versions before 7.21.5 did not provide this error code
+#if defined(LIBCURL_VERSION_NUM) && LIBCURL_VERSION_NUM < 0x071505
+# define CURLE_NOT_BUILT_IN 4
+#endif
+
#define check_curl_result(result, errstr) \
if (result != CURLE_OK && result != CURLE_NOT_BUILT_IN) \
{ \
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/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx
index d7bec44..fc8cf06 100644
--- a/Source/cmGlobalGenerator.cxx
+++ b/Source/cmGlobalGenerator.cxx
@@ -1649,6 +1649,8 @@ void cmGlobalGenerator::ClearGeneratorMembers()
this->ExportSets.clear();
this->TargetDependencies.clear();
+ this->TargetSearchIndex.clear();
+ this->GeneratorTargetSearchIndex.clear();
this->ProjectMap.clear();
this->RuleHashes.clear();
this->DirectoryContentMap.clear();
@@ -2177,75 +2179,40 @@ bool cmGlobalGenerator::IsAlias(const std::string& name) const
return this->AliasTargets.find(name) != this->AliasTargets.end();
}
-cmTarget* cmGlobalGenerator::FindTargetImpl(std::string const& name) const
+void cmGlobalGenerator::IndexTarget(cmTarget* t)
{
- for (unsigned int i = 0; i < this->Makefiles.size(); ++i)
+ if (!t->IsImported() || t->IsImportedGloballyVisible())
{
- cmTargets& tgts = this->Makefiles[i]->GetTargets();
- for (cmTargets::iterator it = tgts.begin(); it != tgts.end(); ++it)
- {
- if (it->second.GetName() == name)
- {
- return &it->second;
- }
- }
+ this->TargetSearchIndex[t->GetName()] = t;
}
- return 0;
}
-cmGeneratorTarget*
-cmGlobalGenerator::FindGeneratorTargetImpl(std::string const& name) const
+void cmGlobalGenerator::IndexGeneratorTarget(cmGeneratorTarget* gt)
{
- for (unsigned int i = 0; i < this->LocalGenerators.size(); ++i)
+ if (!gt->IsImported() || gt->IsImportedGloballyVisible())
{
- const std::vector<cmGeneratorTarget*>& tgts =
- this->LocalGenerators[i]->GetGeneratorTargets();
- for (std::vector<cmGeneratorTarget*>::const_iterator it = tgts.begin();
- it != tgts.end(); ++it)
- {
- if ((*it)->GetName() == name)
- {
- return *it;
- }
- }
+ this->GeneratorTargetSearchIndex[gt->GetName()] = gt;
}
- return 0;
}
-cmTarget*
-cmGlobalGenerator::FindImportedTargetImpl(std::string const& name) const
+cmTarget* cmGlobalGenerator::FindTargetImpl(std::string const& name) const
{
- for (unsigned int i = 0; i < this->Makefiles.size(); ++i)
+ TargetMap::const_iterator i = this->TargetSearchIndex.find(name);
+ if (i != this->TargetSearchIndex.end())
{
- const std::vector<cmTarget*>& tgts =
- this->Makefiles[i]->GetOwnedImportedTargets();
- for (std::vector<cmTarget*>::const_iterator it = tgts.begin();
- it != tgts.end(); ++it)
- {
- if ((*it)->GetName() == name && (*it)->IsImportedGloballyVisible())
- {
- return *it;
- }
- }
+ return i->second;
}
return 0;
}
-cmGeneratorTarget* cmGlobalGenerator::FindImportedGeneratorTargetImpl(
- std::string const& name) const
+cmGeneratorTarget*
+cmGlobalGenerator::FindGeneratorTargetImpl(std::string const& name) const
{
- for (unsigned int i = 0; i < this->LocalGenerators.size(); ++i)
+ GeneratorTargetMap::const_iterator i =
+ this->GeneratorTargetSearchIndex.find(name);
+ if (i != this->GeneratorTargetSearchIndex.end())
{
- const std::vector<cmGeneratorTarget*>& tgts =
- this->LocalGenerators[i]->GetImportedGeneratorTargets();
- for (std::vector<cmGeneratorTarget*>::const_iterator it = tgts.begin();
- it != tgts.end(); ++it)
- {
- if ((*it)->IsImportedGloballyVisible() && (*it)->GetName() == name)
- {
- return *it;
- }
- }
+ return i->second;
}
return 0;
}
@@ -2264,11 +2231,7 @@ cmGlobalGenerator::FindTarget(const std::string& name,
return this->FindTargetImpl(ai->second);
}
}
- if (cmTarget* tgt = this->FindTargetImpl(name))
- {
- return tgt;
- }
- return this->FindImportedTargetImpl(name);
+ return this->FindTargetImpl(name);
}
cmGeneratorTarget*
@@ -2280,11 +2243,7 @@ cmGlobalGenerator::FindGeneratorTarget(const std::string& name) const
{
return this->FindGeneratorTargetImpl(ai->second);
}
- if (cmGeneratorTarget* tgt = this->FindGeneratorTargetImpl(name))
- {
- return tgt;
- }
- return this->FindImportedGeneratorTargetImpl(name);
+ return this->FindGeneratorTargetImpl(name);
}
//----------------------------------------------------------------------------
diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h
index bc6e17d..48fa704 100644
--- a/Source/cmGlobalGenerator.h
+++ b/Source/cmGlobalGenerator.h
@@ -278,6 +278,9 @@ public:
std::set<std::string> const& GetDirectoryContent(std::string const& dir,
bool needDisk = true);
+ void IndexTarget(cmTarget* t);
+ void IndexGeneratorTarget(cmGeneratorTarget* gt);
+
static bool IsReservedTarget(std::string const& name);
virtual const char* GetAllTargetName() const { return "ALL_BUILD"; }
@@ -420,7 +423,6 @@ protected:
std::map<std::string, std::string> AliasTargets;
cmTarget* FindTargetImpl(std::string const& name) const;
- cmTarget* FindImportedTargetImpl(std::string const& name) const;
cmGeneratorTarget* FindGeneratorTargetImpl(std::string const& name) const;
cmGeneratorTarget*
@@ -430,6 +432,26 @@ protected:
virtual bool UseFolderProperty();
private:
+
+#if defined(CMAKE_BUILD_WITH_CMAKE)
+# ifdef CMake_HAVE_CXX11_UNORDERED_MAP
+ typedef std::unordered_map<std::string, cmTarget*> TargetMap;
+ typedef std::unordered_map<std::string, cmGeneratorTarget*>
+ GeneratorTargetMap;
+# else
+ typedef cmsys::hash_map<std::string, cmTarget*> TargetMap;
+ typedef cmsys::hash_map<std::string, cmGeneratorTarget*> GeneratorTargetMap;
+# endif
+#else
+ typedef std::map<std::string,cmTarget *> TargetMap;
+ typedef std::map<std::string,cmGeneratorTarget *> GeneratorTargetMap;
+#endif
+ // Map efficiently from target name to cmTarget instance.
+ // Do not use this structure for looping over all targets.
+ // It contains both normal and globally visible imported targets.
+ TargetMap TargetSearchIndex;
+ GeneratorTargetMap GeneratorTargetSearchIndex;
+
cmMakefile* TryCompileOuterMakefile;
// If you add a new map here, make sure it is copied
// in EnableLanguagesFromGenerator
diff --git a/Source/cmInstallCommand.cxx b/Source/cmInstallCommand.cxx
index 15a83ee..26a1485 100644
--- a/Source/cmInstallCommand.cxx
+++ b/Source/cmInstallCommand.cxx
@@ -33,6 +33,7 @@ static cmInstallTargetGenerator* CreateInstallTargetGenerator(cmTarget& target,
impLib, args.GetPermissions().c_str(),
args.GetConfigurations(), args.GetComponent().c_str(),
message,
+ args.GetExcludeFromAll(),
args.GetOptional() || forceOpt);
}
@@ -48,7 +49,8 @@ static cmInstallFilesGenerator* CreateInstallFilesGenerator(
programs, args.GetPermissions().c_str(),
args.GetConfigurations(), args.GetComponent().c_str(),
message,
- args.GetRename().c_str(), args.GetOptional());
+ args.GetExcludeFromAll(), args.GetRename().c_str(),
+ args.GetOptional());
}
@@ -117,6 +119,7 @@ bool cmInstallCommand::HandleScriptMode(std::vector<std::string> const& args)
int componentCount = 0;
bool doing_script = false;
bool doing_code = false;
+ bool exclude_from_all = false;
// Scan the args once for COMPONENT. Only allow one.
//
@@ -128,6 +131,10 @@ bool cmInstallCommand::HandleScriptMode(std::vector<std::string> const& args)
++i;
component = args[i];
}
+ if(args[i] == "EXCLUDE_FROM_ALL")
+ {
+ exclude_from_all = true;
+ }
}
if(componentCount>1)
@@ -175,7 +182,7 @@ bool cmInstallCommand::HandleScriptMode(std::vector<std::string> const& args)
}
this->Makefile->AddInstallGenerator(
new cmInstallScriptGenerator(script.c_str(), false,
- component.c_str()));
+ component.c_str(), exclude_from_all));
}
else if(doing_code)
{
@@ -183,7 +190,7 @@ bool cmInstallCommand::HandleScriptMode(std::vector<std::string> const& args)
std::string code = args[i];
this->Makefile->AddInstallGenerator(
new cmInstallScriptGenerator(code.c_str(), true,
- component.c_str()));
+ component.c_str(), exclude_from_all));
}
}
@@ -949,6 +956,7 @@ cmInstallCommand::HandleDirectoryMode(std::vector<std::string> const& args)
Doing doing = DoingDirs;
bool in_match_mode = false;
bool optional = false;
+ bool exclude_from_all = false;
bool message_never = false;
std::vector<std::string> dirs;
const char* destination = 0;
@@ -1130,6 +1138,19 @@ cmInstallCommand::HandleDirectoryMode(std::vector<std::string> const& args)
// Switch to setting the component property.
doing = DoingComponent;
}
+ else if(args[i] == "EXCLUDE_FROM_ALL")
+ {
+ if(in_match_mode)
+ {
+ std::ostringstream e;
+ e << args[0] << " does not allow \""
+ << args[i] << "\" after PATTERN or REGEX.";
+ this->SetError(e.str().c_str());
+ return false;
+ }
+ exclude_from_all = true;
+ doing = DoingNone;
+ }
else if(doing == DoingDirs)
{
// Convert this directory to a full path.
@@ -1273,6 +1294,7 @@ cmInstallCommand::HandleDirectoryMode(std::vector<std::string> const& args)
configurations,
component.c_str(),
message,
+ exclude_from_all,
literal_args.c_str(),
optional));
@@ -1374,10 +1396,12 @@ bool cmInstallCommand::HandleExportMode(std::vector<std::string> const& args)
tei != exportSet->GetTargetExports()->end(); ++tei)
{
cmTargetExport const* te = *tei;
- cmTarget* tgt = this->Makefile->FindTarget(te->TargetName);
+ cmTarget* tgt =
+ this->Makefile->GetGlobalGenerator()->FindTarget(te->TargetName);
const bool newCMP0022Behavior =
- tgt->GetPolicyStatusCMP0022() != cmPolicies::WARN
- && tgt->GetPolicyStatusCMP0022() != cmPolicies::OLD;
+ (tgt &&
+ tgt->GetPolicyStatusCMP0022() != cmPolicies::WARN &&
+ tgt->GetPolicyStatusCMP0022() != cmPolicies::OLD);
if(!newCMP0022Behavior)
{
@@ -1401,7 +1425,8 @@ bool cmInstallCommand::HandleExportMode(std::vector<std::string> const& args)
exportSet,
ica.GetDestination().c_str(),
ica.GetPermissions().c_str(), ica.GetConfigurations(),
- ica.GetComponent().c_str(), message, fname.c_str(),
+ ica.GetComponent().c_str(), message,
+ ica.GetExcludeFromAll(), fname.c_str(),
name_space.GetCString(), exportOld.IsEnabled());
this->Makefile->AddInstallGenerator(exportGenerator);
diff --git a/Source/cmInstallCommandArguments.cxx b/Source/cmInstallCommandArguments.cxx
index 236ca1f..6ded365 100644
--- a/Source/cmInstallCommandArguments.cxx
+++ b/Source/cmInstallCommandArguments.cxx
@@ -27,14 +27,15 @@ cmInstallCommandArguments::cmInstallCommandArguments(
const std::string& defaultComponent)
:Parser()
,ArgumentGroup()
-,Destination (&Parser, "DESTINATION" , &ArgumentGroup)
-,Component (&Parser, "COMPONENT" , &ArgumentGroup)
-,Rename (&Parser, "RENAME" , &ArgumentGroup)
-,Permissions (&Parser, "PERMISSIONS" , &ArgumentGroup)
-,Configurations(&Parser, "CONFIGURATIONS", &ArgumentGroup)
-,Optional (&Parser, "OPTIONAL" , &ArgumentGroup)
-,NamelinkOnly (&Parser, "NAMELINK_ONLY" , &ArgumentGroup)
-,NamelinkSkip (&Parser, "NAMELINK_SKIP" , &ArgumentGroup)
+,Destination (&Parser, "DESTINATION" , &ArgumentGroup)
+,Component (&Parser, "COMPONENT" , &ArgumentGroup)
+,ExcludeFromAll(&Parser, "EXCLUDE_FROM_ALL", &ArgumentGroup)
+,Rename (&Parser, "RENAME" , &ArgumentGroup)
+,Permissions (&Parser, "PERMISSIONS" , &ArgumentGroup)
+,Configurations(&Parser, "CONFIGURATIONS" , &ArgumentGroup)
+,Optional (&Parser, "OPTIONAL" , &ArgumentGroup)
+,NamelinkOnly (&Parser, "NAMELINK_ONLY" , &ArgumentGroup)
+,NamelinkSkip (&Parser, "NAMELINK_SKIP" , &ArgumentGroup)
,GenericArguments(0)
,DefaultComponentName(defaultComponent)
{
@@ -110,6 +111,19 @@ bool cmInstallCommandArguments::GetOptional() const
return false;
}
+bool cmInstallCommandArguments::GetExcludeFromAll() const
+{
+ if (this->ExcludeFromAll.IsEnabled())
+ {
+ return true;
+ }
+ if (this->GenericArguments!=0)
+ {
+ return this->GenericArguments->GetExcludeFromAll();
+ }
+ return false;
+}
+
bool cmInstallCommandArguments::GetNamelinkOnly() const
{
if (this->NamelinkOnly.IsEnabled())
diff --git a/Source/cmInstallCommandArguments.h b/Source/cmInstallCommandArguments.h
index 90347e6..694f1ed 100644
--- a/Source/cmInstallCommandArguments.h
+++ b/Source/cmInstallCommandArguments.h
@@ -30,6 +30,7 @@ class cmInstallCommandArguments
const std::string& GetDestination() const;
const std::string& GetComponent() const;
+ bool GetExcludeFromAll() const;
const std::string& GetRename() const;
const std::string& GetPermissions() const;
const std::vector<std::string>& GetConfigurations() const;
@@ -48,6 +49,7 @@ class cmInstallCommandArguments
cmInstallCommandArguments(); // disabled
cmCAString Destination;
cmCAString Component;
+ cmCAEnabler ExcludeFromAll;
cmCAString Rename;
cmCAStringVector Permissions;
cmCAStringVector Configurations;
diff --git a/Source/cmInstallDirectoryGenerator.cxx b/Source/cmInstallDirectoryGenerator.cxx
index f2e8609..6ad6c75 100644
--- a/Source/cmInstallDirectoryGenerator.cxx
+++ b/Source/cmInstallDirectoryGenerator.cxx
@@ -23,9 +23,11 @@ cmInstallDirectoryGenerator
std::vector<std::string> const& configurations,
const char* component,
MessageLevel message,
+ bool exclude_from_all,
const char* literal_args,
bool optional):
- cmInstallGenerator(dest, configurations, component, message),
+ cmInstallGenerator(dest, configurations, component, message,
+ exclude_from_all),
LocalGenerator(0),
Directories(dirs),
FilePermissions(file_permissions), DirPermissions(dir_permissions),
diff --git a/Source/cmInstallDirectoryGenerator.h b/Source/cmInstallDirectoryGenerator.h
index 9b732d3..b137f44 100644
--- a/Source/cmInstallDirectoryGenerator.h
+++ b/Source/cmInstallDirectoryGenerator.h
@@ -27,6 +27,7 @@ public:
std::vector<std::string> const& configurations,
const char* component,
MessageLevel message,
+ bool exclude_from_all,
const char* literal_args,
bool optional = false);
virtual ~cmInstallDirectoryGenerator();
diff --git a/Source/cmInstallExportGenerator.cxx b/Source/cmInstallExportGenerator.cxx
index 9570ba3..80fc054 100644
--- a/Source/cmInstallExportGenerator.cxx
+++ b/Source/cmInstallExportGenerator.cxx
@@ -33,9 +33,11 @@ cmInstallExportGenerator::cmInstallExportGenerator(
std::vector<std::string> const& configurations,
const char* component,
MessageLevel message,
+ bool exclude_from_all,
const char* filename, const char* name_space,
bool exportOld)
- :cmInstallGenerator(destination, configurations, component, message)
+ :cmInstallGenerator(destination, configurations, component, message,
+ exclude_from_all)
,ExportSet(exportSet)
,FilePermissions(file_permissions)
,FileName(filename)
diff --git a/Source/cmInstallExportGenerator.h b/Source/cmInstallExportGenerator.h
index 885ed05..1b1c046 100644
--- a/Source/cmInstallExportGenerator.h
+++ b/Source/cmInstallExportGenerator.h
@@ -31,6 +31,7 @@ public:
const std::vector<std::string>& configurations,
const char* component,
MessageLevel message,
+ bool exclude_from_all,
const char* filename, const char* name_space,
bool exportOld);
~cmInstallExportGenerator();
diff --git a/Source/cmInstallFilesCommand.cxx b/Source/cmInstallFilesCommand.cxx
index 68557bd..d3d258e 100644
--- a/Source/cmInstallFilesCommand.cxx
+++ b/Source/cmInstallFilesCommand.cxx
@@ -122,6 +122,7 @@ void cmInstallFilesCommand::CreateInstallGenerator() const
// Use a file install generator.
const char* no_permissions = "";
const char* no_rename = "";
+ bool no_exclude_from_all = false;
std::string no_component = this->Makefile->GetSafeDefinition(
"CMAKE_INSTALL_DEFAULT_COMPONENT_NAME");
std::vector<std::string> no_configurations;
@@ -131,7 +132,8 @@ void cmInstallFilesCommand::CreateInstallGenerator() const
new cmInstallFilesGenerator(this->Files,
destination.c_str(), false,
no_permissions, no_configurations,
- no_component.c_str(), message, no_rename));
+ no_component.c_str(), message,
+ no_exclude_from_all, no_rename));
}
diff --git a/Source/cmInstallFilesGenerator.cxx b/Source/cmInstallFilesGenerator.cxx
index 383031b..3dd5528 100644
--- a/Source/cmInstallFilesGenerator.cxx
+++ b/Source/cmInstallFilesGenerator.cxx
@@ -24,9 +24,11 @@ cmInstallFilesGenerator
std::vector<std::string> const& configurations,
const char* component,
MessageLevel message,
+ bool exclude_from_all,
const char* rename,
bool optional):
- cmInstallGenerator(dest, configurations, component, message),
+ cmInstallGenerator(dest, configurations, component, message,
+ exclude_from_all),
LocalGenerator(0),
Files(files),
FilePermissions(file_permissions),
diff --git a/Source/cmInstallFilesGenerator.h b/Source/cmInstallFilesGenerator.h
index bfe4039..efaf62b 100644
--- a/Source/cmInstallFilesGenerator.h
+++ b/Source/cmInstallFilesGenerator.h
@@ -26,6 +26,7 @@ public:
std::vector<std::string> const& configurations,
const char* component,
MessageLevel message,
+ bool exclude_from_all,
const char* rename,
bool optional = false);
virtual ~cmInstallFilesGenerator();
diff --git a/Source/cmInstallGenerator.cxx b/Source/cmInstallGenerator.cxx
index 2e1c5f0..660e44f 100644
--- a/Source/cmInstallGenerator.cxx
+++ b/Source/cmInstallGenerator.cxx
@@ -19,11 +19,13 @@ cmInstallGenerator
::cmInstallGenerator(const char* destination,
std::vector<std::string> const& configurations,
const char* component,
- MessageLevel message):
+ MessageLevel message,
+ bool exclude_from_all):
cmScriptGenerator("CMAKE_INSTALL_CONFIG_NAME", configurations),
Destination(destination? destination:""),
Component(component? component:""),
- Message(message)
+ Message(message),
+ ExcludeFromAll(exclude_from_all)
{
}
@@ -146,12 +148,16 @@ void cmInstallGenerator
//----------------------------------------------------------------------------
std::string
-cmInstallGenerator::CreateComponentTest(const char* component)
+cmInstallGenerator::CreateComponentTest(const char* component,
+ bool exclude_from_all)
{
- std::string result = "NOT CMAKE_INSTALL_COMPONENT OR "
- "\"${CMAKE_INSTALL_COMPONENT}\" STREQUAL \"";
+ std::string result = "\"${CMAKE_INSTALL_COMPONENT}\" STREQUAL \"";
result += component;
result += "\"";
+ if(!exclude_from_all)
+ {
+ result += " OR NOT CMAKE_INSTALL_COMPONENT";
+ }
return result;
}
@@ -163,7 +169,7 @@ void cmInstallGenerator::GenerateScript(std::ostream& os)
// Begin this block of installation.
std::string component_test =
- this->CreateComponentTest(this->Component.c_str());
+ this->CreateComponentTest(this->Component.c_str(),this->ExcludeFromAll);
os << indent << "if(" << component_test << ")\n";
// Generate the script possibly with per-configuration code.
diff --git a/Source/cmInstallGenerator.h b/Source/cmInstallGenerator.h
index b8e5b53..db895908 100644
--- a/Source/cmInstallGenerator.h
+++ b/Source/cmInstallGenerator.h
@@ -36,7 +36,8 @@ public:
cmInstallGenerator(const char* destination,
std::vector<std::string> const& configurations,
const char* component,
- MessageLevel message);
+ MessageLevel message,
+ bool exclude_from_all);
virtual ~cmInstallGenerator();
void AddInstallRule(
@@ -67,12 +68,14 @@ public:
protected:
virtual void GenerateScript(std::ostream& os);
- std::string CreateComponentTest(const char* component);
+ std::string CreateComponentTest(const char* component,
+ bool exclude_from_all);
// Information shared by most generator types.
std::string Destination;
std::string Component;
MessageLevel Message;
+ bool ExcludeFromAll;
};
#endif
diff --git a/Source/cmInstallProgramsCommand.cxx b/Source/cmInstallProgramsCommand.cxx
index e6fbe88..b6d0c45 100644
--- a/Source/cmInstallProgramsCommand.cxx
+++ b/Source/cmInstallProgramsCommand.cxx
@@ -85,6 +85,7 @@ void cmInstallProgramsCommand::FinalPass()
// Use a file install generator.
const char* no_permissions = "";
const char* no_rename = "";
+ bool no_exclude_from_all = false;
std::string no_component = this->Makefile->GetSafeDefinition(
"CMAKE_INSTALL_DEFAULT_COMPONENT_NAME");
std::vector<std::string> no_configurations;
@@ -94,7 +95,8 @@ void cmInstallProgramsCommand::FinalPass()
new cmInstallFilesGenerator(this->Files,
destination.c_str(), true,
no_permissions, no_configurations,
- no_component.c_str(), message, no_rename));
+ no_component.c_str(), message,
+ no_exclude_from_all, no_rename));
}
/**
diff --git a/Source/cmInstallScriptGenerator.cxx b/Source/cmInstallScriptGenerator.cxx
index 933aa07..d58d039 100644
--- a/Source/cmInstallScriptGenerator.cxx
+++ b/Source/cmInstallScriptGenerator.cxx
@@ -14,8 +14,9 @@
//----------------------------------------------------------------------------
cmInstallScriptGenerator
::cmInstallScriptGenerator(const char* script, bool code,
- const char* component) :
- cmInstallGenerator(0, std::vector<std::string>(), component, MessageDefault),
+ const char* component, bool exclude_from_all) :
+ cmInstallGenerator(0, std::vector<std::string>(), component, MessageDefault,
+ exclude_from_all),
Script(script), Code(code)
{
}
@@ -31,7 +32,7 @@ void cmInstallScriptGenerator::GenerateScript(std::ostream& os)
{
Indent indent;
std::string component_test =
- this->CreateComponentTest(this->Component.c_str());
+ this->CreateComponentTest(this->Component.c_str(), this->ExcludeFromAll);
os << indent << "if(" << component_test << ")\n";
if(this->Code)
diff --git a/Source/cmInstallScriptGenerator.h b/Source/cmInstallScriptGenerator.h
index 54a7b21..7e7c0c8 100644
--- a/Source/cmInstallScriptGenerator.h
+++ b/Source/cmInstallScriptGenerator.h
@@ -21,7 +21,7 @@ class cmInstallScriptGenerator: public cmInstallGenerator
{
public:
cmInstallScriptGenerator(const char* script, bool code,
- const char* component);
+ const char* component, bool exclude_from_all);
virtual ~cmInstallScriptGenerator();
protected:
diff --git a/Source/cmInstallTargetGenerator.cxx b/Source/cmInstallTargetGenerator.cxx
index 5e88fa2..3d44fe2 100644
--- a/Source/cmInstallTargetGenerator.cxx
+++ b/Source/cmInstallTargetGenerator.cxx
@@ -30,8 +30,10 @@ cmInstallTargetGenerator
std::vector<std::string> const& configurations,
const char* component,
MessageLevel message,
+ bool exclude_from_all,
bool optional):
- cmInstallGenerator(dest, configurations, component, message),
+ cmInstallGenerator(dest, configurations, component, message,
+ exclude_from_all),
TargetName(targetName),
Target(0),
FilePermissions(file_permissions),
diff --git a/Source/cmInstallTargetGenerator.h b/Source/cmInstallTargetGenerator.h
index 18b3130..46b4532 100644
--- a/Source/cmInstallTargetGenerator.h
+++ b/Source/cmInstallTargetGenerator.h
@@ -28,6 +28,7 @@ public:
std::vector<std::string> const& configurations,
const char* component,
MessageLevel message,
+ bool exclude_from_all,
bool optional
);
virtual ~cmInstallTargetGenerator();
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/cmListFileCache.h b/Source/cmListFileCache.h
index 03e0abe..4d3055f 100644
--- a/Source/cmListFileCache.h
+++ b/Source/cmListFileCache.h
@@ -58,8 +58,9 @@ struct cmListFileArgument
long Line;
};
-struct cmListFileContext
+class cmListFileContext
{
+public:
std::string Name;
std::string FilePath;
long Line;
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index 1d17032..6a6359a 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -455,11 +455,13 @@ void cmLocalGenerator::GenerateInstallRules()
void cmLocalGenerator::AddGeneratorTarget(cmGeneratorTarget* gt)
{
this->GeneratorTargets.push_back(gt);
+ this->GlobalGenerator->IndexGeneratorTarget(gt);
}
void cmLocalGenerator::AddImportedGeneratorTarget(cmGeneratorTarget* gt)
{
this->ImportedGeneratorTargets.push_back(gt);
+ this->GlobalGenerator->IndexGeneratorTarget(gt);
}
void cmLocalGenerator::AddOwnedImportedGeneratorTarget(cmGeneratorTarget* gt)
@@ -2557,7 +2559,7 @@ public:
cmInstallTargetGenerator(
t, dest, implib, "", std::vector<std::string>(), "Unspecified",
cmInstallGenerator::SelectMessageLevel(lg->GetMakefile()),
- false)
+ false, false)
{
this->Compute(lg);
}
@@ -2584,7 +2586,7 @@ cmLocalGenerator
// Include the user-specified pre-install script for this target.
if(const char* preinstall = (*l)->GetProperty("PRE_INSTALL_SCRIPT"))
{
- cmInstallScriptGenerator g(preinstall, false, 0);
+ cmInstallScriptGenerator g(preinstall, false, 0, false);
g.Generate(os, config, configurationTypes);
}
@@ -2645,7 +2647,7 @@ cmLocalGenerator
// Include the user-specified post-install script for this target.
if(const char* postinstall = (*l)->GetProperty("POST_INSTALL_SCRIPT"))
{
- cmInstallScriptGenerator g(postinstall, false, 0);
+ cmInstallScriptGenerator g(postinstall, false, 0, false);
g.Generate(os, config, configurationTypes);
}
}
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index cba29eb..950b247 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -2128,6 +2128,7 @@ cmMakefile::AddNewTarget(cmState::TargetType type, const std::string& name)
cmTarget& target = it->second;
target.SetType(type, name);
target.SetMakefile(this);
+ this->GetGlobalGenerator()->IndexTarget(&it->second);
return &it->second;
}
@@ -4218,6 +4219,7 @@ cmMakefile::AddImportedTarget(const std::string& name,
// Add to the set of available imported targets.
this->ImportedTargets[name] = target.get();
+ this->GetGlobalGenerator()->IndexTarget(target.get());
// Transfer ownership to this cmMakefile object.
this->ImportedTargetsOwned.push_back(target.get());
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)
{
diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx
index 1dc304c..e9d77b2 100644
--- a/Source/cmcmd.cxx
+++ b/Source/cmcmd.cxx
@@ -813,10 +813,8 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args)
{
cm.SetGlobalGenerator(ggd);
cmState::Snapshot snapshot = cm.GetCurrentSnapshot();
- snapshot.GetDirectory().SetCurrentBinary
- (cmSystemTools::GetCurrentWorkingDirectory());
- snapshot.GetDirectory().SetCurrentSource
- (cmSystemTools::GetCurrentWorkingDirectory());
+ snapshot.GetDirectory().SetCurrentBinary(startOutDir);
+ snapshot.GetDirectory().SetCurrentSource(startDir);
cmsys::auto_ptr<cmMakefile> mf(new cmMakefile(ggd, snapshot));
cmsys::auto_ptr<cmLocalGenerator> lgd(
ggd->CreateLocalGenerator(mf.get()));