summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
Diffstat (limited to 'Source')
-rw-r--r--Source/CMakeVersion.cmake2
-rw-r--r--Source/QtDialog/CMakeSetupDialog.cxx13
-rw-r--r--Source/cmDocumentation.cxx35
-rw-r--r--Source/cmDocumentation.h2
-rw-r--r--Source/cmExternalMakefileProjectGenerator.cxx6
-rw-r--r--Source/cmExternalMakefileProjectGenerator.h2
-rw-r--r--Source/cmExtraEclipseCDT4Generator.cxx50
-rw-r--r--Source/cmExtraEclipseCDT4Generator.h3
-rw-r--r--Source/cmGeneratorTarget.cxx4
-rw-r--r--Source/cmGeneratorTarget.h2
-rw-r--r--Source/cmGlobalGenerator.cxx25
-rw-r--r--Source/cmGlobalGenerator.h6
-rw-r--r--Source/cmGlobalKdevelopGenerator.cxx2
-rw-r--r--Source/cmLocalVisualStudio7Generator.cxx2
-rw-r--r--Source/cmMakefile.cxx83
-rw-r--r--Source/cmMakefile.h4
-rw-r--r--Source/cmNinjaNormalTargetGenerator.cxx2
-rw-r--r--Source/cmPolicies.cxx5
-rw-r--r--Source/cmPolicies.h2
-rw-r--r--Source/cmQtAutoGenerators.cxx2
-rw-r--r--Source/cmTarget.cxx38
-rw-r--r--Source/cmTarget.h54
-rw-r--r--Source/cmVisualStudio10TargetGenerator.cxx6
-rw-r--r--Source/cmVisualStudio10TargetGenerator.h3
24 files changed, 232 insertions, 121 deletions
diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake
index 5adced0..a174456 100644
--- a/Source/CMakeVersion.cmake
+++ b/Source/CMakeVersion.cmake
@@ -2,5 +2,5 @@
set(CMake_VERSION_MAJOR 2)
set(CMake_VERSION_MINOR 8)
set(CMake_VERSION_PATCH 12)
-set(CMake_VERSION_TWEAK 20131119)
+set(CMake_VERSION_TWEAK 20131122)
#set(CMake_VERSION_RC 1)
diff --git a/Source/QtDialog/CMakeSetupDialog.cxx b/Source/QtDialog/CMakeSetupDialog.cxx
index a7665c8..8565cad 100644
--- a/Source/QtDialog/CMakeSetupDialog.cxx
+++ b/Source/QtDialog/CMakeSetupDialog.cxx
@@ -807,10 +807,14 @@ void CMakeSetupDialog::doDeleteCache()
void CMakeSetupDialog::doAbout()
{
- QString msg = tr("CMake %1\n"
- "Using Qt %2\n"
- "www.cmake.org");
-
+ QString msg = tr(
+ "CMake %1 (cmake.org).\n"
+ "CMake suite maintained by Kitware, Inc. (kitware.com).\n"
+ "Distributed under terms of the BSD 3-Clause License.\n"
+ "\n"
+ "CMake GUI maintained by csimsoft,\n"
+ "built using Qt %2 (qt-project.org).\n"
+ );
msg = msg.arg(cmVersion::GetCMakeVersion());
msg = msg.arg(qVersion());
@@ -946,6 +950,7 @@ void CMakeSetupDialog::saveBuildPaths(const QStringList& paths)
void CMakeSetupDialog::setCacheModified()
{
this->CacheModified = true;
+ this->ConfigureNeeded = true;
this->enterState(ReadyConfigure);
}
diff --git a/Source/cmDocumentation.cxx b/Source/cmDocumentation.cxx
index 8029577..8576bf2 100644
--- a/Source/cmDocumentation.cxx
+++ b/Source/cmDocumentation.cxx
@@ -95,8 +95,12 @@ cmDocumentation::~cmDocumentation()
//----------------------------------------------------------------------------
bool cmDocumentation::PrintVersion(std::ostream& os)
{
- os << this->GetNameString() << " version "
- << cmVersion::GetCMakeVersion() << "\n";
+ os <<
+ this->GetNameString() <<
+ " version " << cmVersion::GetCMakeVersion() << "\n"
+ "\n"
+ "CMake suite maintained by Kitware, Inc. (kitware.com).\n"
+ ;
return true;
}
@@ -195,24 +199,27 @@ bool cmDocumentation::PrintRequestedDocumentation(std::ostream& os)
void cmDocumentation::WarnFormFromFilename(
- cmDocumentation::RequestedHelpItem& request)
+ cmDocumentation::RequestedHelpItem& request, bool& result)
{
std::string ext = cmSystemTools::GetFilenameLastExtension(request.Filename);
ext = cmSystemTools::UpperCase(ext);
if ((ext == ".HTM") || (ext == ".HTML"))
{
request.HelpType = cmDocumentation::None;
+ result = true;
cmSystemTools::Message("Warning: HTML help format no longer supported");
}
else if (ext == ".DOCBOOK")
{
request.HelpType = cmDocumentation::None;
+ result = true;
cmSystemTools::Message("Warning: Docbook help format no longer supported");
}
// ".1" to ".9" should be manpages
else if ((ext.length()==2) && (ext[1] >='1') && (ext[1]<='9'))
{
request.HelpType = cmDocumentation::None;
+ result = true;
cmSystemTools::Message("Warning: Man help format no longer supported");
}
}
@@ -300,28 +307,28 @@ bool cmDocumentation::CheckOptions(int argc, const char* const* argv,
help.HelpType = cmDocumentation::OneManual;
help.Argument = "cmake-properties.7";
GET_OPT_ARGUMENT(help.Filename);
- this->WarnFormFromFilename(help);
+ this->WarnFormFromFilename(help, result);
}
else if(strcmp(argv[i], "--help-policies") == 0)
{
help.HelpType = cmDocumentation::OneManual;
help.Argument = "cmake-policies.7";
GET_OPT_ARGUMENT(help.Filename);
- this->WarnFormFromFilename(help);
+ this->WarnFormFromFilename(help, result);
}
else if(strcmp(argv[i], "--help-variables") == 0)
{
help.HelpType = cmDocumentation::OneManual;
help.Argument = "cmake-variables.7";
GET_OPT_ARGUMENT(help.Filename);
- this->WarnFormFromFilename(help);
+ this->WarnFormFromFilename(help, result);
}
else if(strcmp(argv[i], "--help-modules") == 0)
{
help.HelpType = cmDocumentation::OneManual;
help.Argument = "cmake-modules.7";
GET_OPT_ARGUMENT(help.Filename);
- this->WarnFormFromFilename(help);
+ this->WarnFormFromFilename(help, result);
}
else if(strcmp(argv[i], "--help-custom-modules") == 0)
{
@@ -335,7 +342,7 @@ bool cmDocumentation::CheckOptions(int argc, const char* const* argv,
help.HelpType = cmDocumentation::OneManual;
help.Argument = "cmake-commands.7";
GET_OPT_ARGUMENT(help.Filename);
- this->WarnFormFromFilename(help);
+ this->WarnFormFromFilename(help, result);
}
else if(strcmp(argv[i], "--help-compatcommands") == 0)
{
@@ -368,42 +375,42 @@ bool cmDocumentation::CheckOptions(int argc, const char* const* argv,
GET_OPT_ARGUMENT(help.Argument);
GET_OPT_ARGUMENT(help.Filename);
help.Argument = cmSystemTools::LowerCase(help.Argument);
- this->WarnFormFromFilename(help);
+ this->WarnFormFromFilename(help, result);
}
else if(strcmp(argv[i], "--help-module") == 0)
{
help.HelpType = cmDocumentation::OneModule;
GET_OPT_ARGUMENT(help.Argument);
GET_OPT_ARGUMENT(help.Filename);
- this->WarnFormFromFilename(help);
+ this->WarnFormFromFilename(help, result);
}
else if(strcmp(argv[i], "--help-property") == 0)
{
help.HelpType = cmDocumentation::OneProperty;
GET_OPT_ARGUMENT(help.Argument);
GET_OPT_ARGUMENT(help.Filename);
- this->WarnFormFromFilename(help);
+ this->WarnFormFromFilename(help, result);
}
else if(strcmp(argv[i], "--help-policy") == 0)
{
help.HelpType = cmDocumentation::OnePolicy;
GET_OPT_ARGUMENT(help.Argument);
GET_OPT_ARGUMENT(help.Filename);
- this->WarnFormFromFilename(help);
+ this->WarnFormFromFilename(help, result);
}
else if(strcmp(argv[i], "--help-variable") == 0)
{
help.HelpType = cmDocumentation::OneVariable;
GET_OPT_ARGUMENT(help.Argument);
GET_OPT_ARGUMENT(help.Filename);
- this->WarnFormFromFilename(help);
+ this->WarnFormFromFilename(help, result);
}
else if(strcmp(argv[i], "--help-manual") == 0)
{
help.HelpType = cmDocumentation::OneManual;
GET_OPT_ARGUMENT(help.Argument);
GET_OPT_ARGUMENT(help.Filename);
- this->WarnFormFromFilename(help);
+ this->WarnFormFromFilename(help, result);
}
else if(strcmp(argv[i], "--help-command-list") == 0)
{
diff --git a/Source/cmDocumentation.h b/Source/cmDocumentation.h
index 209cc27..05c0442 100644
--- a/Source/cmDocumentation.h
+++ b/Source/cmDocumentation.h
@@ -137,7 +137,7 @@ private:
std::vector<RequestedHelpItem> RequestedHelpItems;
cmDocumentationFormatter Formatter;
- static void WarnFormFromFilename(RequestedHelpItem& request);
+ static void WarnFormFromFilename(RequestedHelpItem& request, bool& result);
};
#endif
diff --git a/Source/cmExternalMakefileProjectGenerator.cxx b/Source/cmExternalMakefileProjectGenerator.cxx
index 9c965cc..0d42c35 100644
--- a/Source/cmExternalMakefileProjectGenerator.cxx
+++ b/Source/cmExternalMakefileProjectGenerator.cxx
@@ -13,6 +13,12 @@
#include "cmExternalMakefileProjectGenerator.h"
+void cmExternalMakefileProjectGenerator
+::EnableLanguage(std::vector<std::string> const&,
+ cmMakefile *, bool)
+{
+}
+
std::string cmExternalMakefileProjectGenerator::CreateFullGeneratorName(
const char* globalGenerator,
const char* extraGenerator)
diff --git a/Source/cmExternalMakefileProjectGenerator.h b/Source/cmExternalMakefileProjectGenerator.h
index 182c1a8..bce441d 100644
--- a/Source/cmExternalMakefileProjectGenerator.h
+++ b/Source/cmExternalMakefileProjectGenerator.h
@@ -41,6 +41,8 @@ public:
/** Get the documentation entry for this generator. */
virtual void GetDocumentation(cmDocumentationEntry& entry,
const char* fullName) const = 0;
+ virtual void EnableLanguage(std::vector<std::string> const& languages,
+ cmMakefile *, bool optional);
///! set the global generator which will generate the makefiles
virtual void SetGlobalGenerator(cmGlobalGenerator* generator)
diff --git a/Source/cmExtraEclipseCDT4Generator.cxx b/Source/cmExtraEclipseCDT4Generator.cxx
index 676d4ed..755b445 100644
--- a/Source/cmExtraEclipseCDT4Generator.cxx
+++ b/Source/cmExtraEclipseCDT4Generator.cxx
@@ -51,6 +51,29 @@ void cmExtraEclipseCDT4Generator
}
//----------------------------------------------------------------------------
+void cmExtraEclipseCDT4Generator
+::EnableLanguage(std::vector<std::string> const& languages,
+ cmMakefile *, bool)
+{
+ for (std::vector<std::string>::const_iterator lit = languages.begin();
+ lit != languages.end(); ++lit)
+ {
+ if (*lit == "CXX")
+ {
+ this->Natures.insert("org.eclipse.cdt.core.ccnature");
+ }
+ else if (*lit == "C")
+ {
+ this->Natures.insert("org.eclipse.cdt.core.cnature");
+ }
+ else if (*lit == "Java")
+ {
+ this->Natures.insert("org.eclipse.jdt.core.javanature");
+ }
+ }
+}
+
+//----------------------------------------------------------------------------
void cmExtraEclipseCDT4Generator::Generate()
{
const cmMakefile* mf
@@ -433,13 +456,28 @@ void cmExtraEclipseCDT4Generator::CreateProjectFile()
// set natures for c/c++ projects
fout <<
"\t<natures>\n"
- // TODO: ccnature only if it is c++ ???
- "\t\t<nature>org.eclipse.cdt.core.ccnature</nature>\n"
"\t\t<nature>org.eclipse.cdt.make.core.makeNature</nature>\n"
- "\t\t<nature>org.eclipse.cdt.make.core.ScannerConfigNature</nature>\n"
- "\t\t<nature>org.eclipse.cdt.core.cnature</nature>\n"
- "\t</natures>\n"
- ;
+ "\t\t<nature>org.eclipse.cdt.make.core.ScannerConfigNature</nature>\n";
+
+ for (std::set<std::string>::const_iterator nit=this->Natures.begin();
+ nit != this->Natures.end(); ++nit)
+ {
+ fout << "\t\t<nature>" << *nit << "</nature>\n";
+ }
+
+ if (const char *extraNaturesProp = mf->GetCMakeInstance()->
+ GetProperty("ECLIPSE_EXTRA_NATURES", cmProperty::GLOBAL))
+ {
+ std::vector<std::string> extraNatures;
+ cmSystemTools::ExpandListArgument(extraNaturesProp, extraNatures);
+ for (std::vector<std::string>::const_iterator nit = extraNatures.begin();
+ nit != extraNatures.end(); ++nit)
+ {
+ fout << "\t\t<nature>" << *nit << "</nature>\n";
+ }
+ }
+
+ fout << "\t</natures>\n";
fout << "\t<linkedResources>\n";
// create linked resources
diff --git a/Source/cmExtraEclipseCDT4Generator.h b/Source/cmExtraEclipseCDT4Generator.h
index b31cce7..9c89f85 100644
--- a/Source/cmExtraEclipseCDT4Generator.h
+++ b/Source/cmExtraEclipseCDT4Generator.h
@@ -41,6 +41,8 @@ public:
virtual void GetDocumentation(cmDocumentationEntry& entry,
const char* fullName) const;
+ virtual void EnableLanguage(std::vector<std::string> const& languages,
+ cmMakefile *, bool optional);
virtual void Generate();
@@ -105,6 +107,7 @@ private:
void CreateLinksForTargets(cmGeneratedFileStream& fout);
std::vector<std::string> SrcLinkedResources;
+ std::set<std::string> Natures;
std::string HomeDirectory;
std::string HomeOutputDirectory;
bool IsOutOfSourceBuild;
diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx
index b964f71..011fc6c 100644
--- a/Source/cmGeneratorTarget.cxx
+++ b/Source/cmGeneratorTarget.cxx
@@ -611,8 +611,8 @@ const char* cmGeneratorTarget::GetCreateRuleVariable() const
}
//----------------------------------------------------------------------------
-std::vector<std::string> cmGeneratorTarget::GetIncludeDirectories(
- const char *config)
+std::vector<std::string>
+cmGeneratorTarget::GetIncludeDirectories(const char *config) const
{
return this->Target->GetIncludeDirectories(config);
}
diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h
index 177bc25..69d1bb2 100644
--- a/Source/cmGeneratorTarget.h
+++ b/Source/cmGeneratorTarget.h
@@ -70,7 +70,7 @@ public:
const char* GetCreateRuleVariable() const;
/** Get the include directories for this target. */
- std::vector<std::string> GetIncludeDirectories(const char *config);
+ std::vector<std::string> GetIncludeDirectories(const char *config) const;
bool IsSystemIncludeDirectory(const char *dir, const char *config) const;
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx
index 65a7118..20cd15e 100644
--- a/Source/cmGlobalGenerator.cxx
+++ b/Source/cmGlobalGenerator.cxx
@@ -695,6 +695,11 @@ cmGlobalGenerator::EnableLanguage(std::vector<std::string>const& languages,
{
mf->ReadListFile(0,projectCompatibility.c_str());
}
+ // Inform any extra generator of the new language.
+ if (this->ExtraGenerator)
+ {
+ this->ExtraGenerator->EnableLanguage(languages, mf, false);
+ }
if(fatalError)
{
@@ -1981,7 +1986,7 @@ void cmGlobalGenerator::AddAlias(const char *name, cmTarget *tgt)
}
//----------------------------------------------------------------------------
-bool cmGlobalGenerator::IsAlias(const char *name)
+bool cmGlobalGenerator::IsAlias(const char *name) const
{
return this->AliasTargets.find(name) != this->AliasTargets.end();
}
@@ -1989,15 +1994,16 @@ bool cmGlobalGenerator::IsAlias(const char *name)
//----------------------------------------------------------------------------
cmTarget*
cmGlobalGenerator::FindTarget(const char* project, const char* name,
- bool excludeAliases)
+ bool excludeAliases) const
{
// if project specific
if(project)
{
- std::vector<cmLocalGenerator*>* gens = &this->ProjectMap[project];
- for(unsigned int i = 0; i < gens->size(); ++i)
+ std::map<cmStdString, std::vector<cmLocalGenerator*> >::const_iterator
+ gens = this->ProjectMap.find(project);
+ for(unsigned int i = 0; i < gens->second.size(); ++i)
{
- cmTarget* ret = (*gens)[i]->GetMakefile()->FindTarget(name,
+ cmTarget* ret = (gens->second)[i]->GetMakefile()->FindTarget(name,
excludeAliases);
if(ret)
{
@@ -2010,14 +2016,14 @@ cmGlobalGenerator::FindTarget(const char* project, const char* name,
{
if (!excludeAliases)
{
- std::map<cmStdString, cmTarget*>::iterator ai
+ std::map<cmStdString, cmTarget*>::const_iterator ai
= this->AliasTargets.find(name);
if (ai != this->AliasTargets.end())
{
return ai->second;
}
}
- std::map<cmStdString,cmTarget *>::iterator i =
+ std::map<cmStdString,cmTarget *>::const_iterator i =
this->TotalTargets.find ( name );
if ( i != this->TotalTargets.end() )
{
@@ -2033,7 +2039,8 @@ cmGlobalGenerator::FindTarget(const char* project, const char* name,
}
//----------------------------------------------------------------------------
-bool cmGlobalGenerator::NameResolvesToFramework(const std::string& libname)
+bool
+cmGlobalGenerator::NameResolvesToFramework(const std::string& libname) const
{
if(cmSystemTools::IsPathToFramework(libname.c_str()))
{
@@ -2407,7 +2414,7 @@ cmTarget cmGlobalGenerator::CreateGlobalTarget(
// Store the custom command in the target.
cmCustomCommand cc(0, no_outputs, no_depends, *commandLines, 0,
workingDirectory);
- target.GetPostBuildCommands().push_back(cc);
+ target.AddPostBuildCommand(cc);
target.SetProperty("EchoString", message);
std::vector<std::string>::iterator dit;
for ( dit = depends.begin(); dit != depends.end(); ++ dit )
diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h
index ae139ed..eb720a8 100644
--- a/Source/cmGlobalGenerator.h
+++ b/Source/cmGlobalGenerator.h
@@ -207,14 +207,14 @@ public:
///! Find a target by name by searching the local generators.
cmTarget* FindTarget(const char* project, const char* name,
- bool excludeAliases = false);
+ bool excludeAliases = false) const;
void AddAlias(const char *name, cmTarget *tgt);
- bool IsAlias(const char *name);
+ bool IsAlias(const char *name) const;
/** Determine if a name resolves to a framework on disk or a built target
that is a framework. */
- bool NameResolvesToFramework(const std::string& libname);
+ bool NameResolvesToFramework(const std::string& libname) const;
/** If check to see if the target is linked to by any other
target in the project */
diff --git a/Source/cmGlobalKdevelopGenerator.cxx b/Source/cmGlobalKdevelopGenerator.cxx
index 273d4bb..ab7db51 100644
--- a/Source/cmGlobalKdevelopGenerator.cxx
+++ b/Source/cmGlobalKdevelopGenerator.cxx
@@ -75,7 +75,7 @@ void cmGlobalKdevelopGenerator::Generate()
{
if (ti->second.GetType()==cmTarget::EXECUTABLE)
{
- executable = ti->second.GetProperty("LOCATION");
+ executable = ti->second.GetLocation(0);
break;
}
}
diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx
index 30c3d73..2fd1016 100644
--- a/Source/cmLocalVisualStudio7Generator.cxx
+++ b/Source/cmLocalVisualStudio7Generator.cxx
@@ -482,6 +482,8 @@ cmVS7FlagTable cmLocalVisualStudio7GeneratorFlagTable[] =
{"AssemblerListingLocation", "Fa", "ASM List Location", "",
cmVS7FlagTable::UserValue},
+ {"ProgramDataBaseFileName", "Fd", "Program Database File Name", "",
+ cmVS7FlagTable::UserValue},
// boolean flags
{"BufferSecurityCheck", "GS", "Buffer security check", "TRUE", 0},
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index ac8381c..e073f76 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -884,34 +884,61 @@ cmMakefile::AddCustomCommandToTarget(const char* target,
{
// Find the target to which to add the custom command.
cmTargets::iterator ti = this->Targets.find(target);
- if(ti != this->Targets.end())
+
+ if(ti == this->Targets.end())
{
- if(ti->second.GetType() == cmTarget::OBJECT_LIBRARY)
+ cmake::MessageType messageType = cmake::AUTHOR_WARNING;
+ bool issueMessage = false;
+ switch(this->GetPolicyStatus(cmPolicies::CMP0040))
{
- cmOStringStream e;
- e << "Target \"" << target << "\" is an OBJECT library "
- "that may not have PRE_BUILD, PRE_LINK, or POST_BUILD commands.";
- this->IssueMessage(cmake::FATAL_ERROR, e.str());
- return;
+ case cmPolicies::WARN:
+ issueMessage = true;
+ case cmPolicies::OLD:
+ break;
+ case cmPolicies::NEW:
+ case cmPolicies::REQUIRED_IF_USED:
+ case cmPolicies::REQUIRED_ALWAYS:
+ issueMessage = true;
+ messageType = cmake::FATAL_ERROR;
}
- // Add the command to the appropriate build step for the target.
- std::vector<std::string> no_output;
- cmCustomCommand cc(this, no_output, depends,
- commandLines, comment, workingDir);
- cc.SetEscapeOldStyle(escapeOldStyle);
- cc.SetEscapeAllowMakeVars(true);
- switch(type)
+
+ if(issueMessage)
{
- case cmTarget::PRE_BUILD:
- ti->second.GetPreBuildCommands().push_back(cc);
- break;
- case cmTarget::PRE_LINK:
- ti->second.GetPreLinkCommands().push_back(cc);
- break;
- case cmTarget::POST_BUILD:
- ti->second.GetPostBuildCommands().push_back(cc);
- break;
+ cmOStringStream e;
+ e << (this->GetPolicies()
+ ->GetPolicyWarning(cmPolicies::CMP0040)) << "\n";
+ e << "The target name \"" << target << "\" is unknown in this context.";
+ IssueMessage(messageType, e.str().c_str());
}
+
+ return;
+ }
+
+ if(ti->second.GetType() == cmTarget::OBJECT_LIBRARY)
+ {
+ cmOStringStream e;
+ e << "Target \"" << target << "\" is an OBJECT library "
+ "that may not have PRE_BUILD, PRE_LINK, or POST_BUILD commands.";
+ this->IssueMessage(cmake::FATAL_ERROR, e.str());
+ return;
+ }
+ // Add the command to the appropriate build step for the target.
+ std::vector<std::string> no_output;
+ cmCustomCommand cc(this, no_output, depends,
+ commandLines, comment, workingDir);
+ cc.SetEscapeOldStyle(escapeOldStyle);
+ cc.SetEscapeAllowMakeVars(true);
+ switch(type)
+ {
+ case cmTarget::PRE_BUILD:
+ ti->second.AddPreBuildCommand(cc);
+ break;
+ case cmTarget::PRE_LINK:
+ ti->second.AddPreLinkCommand(cc);
+ break;
+ case cmTarget::POST_BUILD:
+ ti->second.AddPostBuildCommand(cc);
+ break;
}
}
@@ -3822,21 +3849,19 @@ const char* cmMakefile::GetFeature(const char* feature, const char* config)
return 0;
}
-cmTarget* cmMakefile::FindTarget(const char* name, bool excludeAliases)
+cmTarget* cmMakefile::FindTarget(const char* name, bool excludeAliases) const
{
if (!excludeAliases)
{
- std::map<std::string, cmTarget*>::iterator i
+ std::map<std::string, cmTarget*>::const_iterator i
= this->AliasTargets.find(name);
if (i != this->AliasTargets.end())
{
return i->second;
}
}
- cmTargets& tgts = this->GetTargets();
-
- cmTargets::iterator i = tgts.find ( name );
- if ( i != tgts.end() )
+ cmTargets::iterator i = this->Targets.find( name );
+ if ( i != this->Targets.end() )
{
return &i->second;
}
diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h
index 76958ca..44aaa66 100644
--- a/Source/cmMakefile.h
+++ b/Source/cmMakefile.h
@@ -533,7 +533,7 @@ public:
this->GeneratorTargets = targets;
}
- cmTarget* FindTarget(const char* name, bool excludeAliases = false);
+ cmTarget* FindTarget(const char* name, bool excludeAliases = false) const;
/** Find a target to use in place of the given name. The target
returned may be imported or built within the project. */
@@ -902,7 +902,7 @@ protected:
std::string ProjectName; // project name
// libraries, classes, and executables
- cmTargets Targets;
+ mutable cmTargets Targets;
std::map<std::string, cmTarget*> AliasTargets;
cmGeneratorTargetsType GeneratorTargets;
std::vector<cmSourceFile*> SourceFiles;
diff --git a/Source/cmNinjaNormalTargetGenerator.cxx b/Source/cmNinjaNormalTargetGenerator.cxx
index 015654b..d8e9b34 100644
--- a/Source/cmNinjaNormalTargetGenerator.cxx
+++ b/Source/cmNinjaNormalTargetGenerator.cxx
@@ -534,7 +534,7 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement()
std::replace(linkLibraries.begin(), linkLibraries.end(), '\\', '/');
}
- std::vector<cmCustomCommand> *cmdLists[3] = {
+ const std::vector<cmCustomCommand> *cmdLists[3] = {
&this->GetTarget()->GetPreBuildCommands(),
&this->GetTarget()->GetPreLinkCommands(),
&this->GetTarget()->GetPostBuildCommands()
diff --git a/Source/cmPolicies.cxx b/Source/cmPolicies.cxx
index a18fc16..b9b469c 100644
--- a/Source/cmPolicies.cxx
+++ b/Source/cmPolicies.cxx
@@ -301,6 +301,11 @@ cmPolicies::cmPolicies()
CMP0039, "CMP0039",
"Utility targets may not have link dependencies.",
3,0,0,0, cmPolicies::WARN);
+
+ this->DefinePolicy(
+ CMP0040, "CMP0040",
+ "The target in the TARGET signature of add_custom_command() must exist.",
+ 3,0,0,0, cmPolicies::WARN);
}
cmPolicies::~cmPolicies()
diff --git a/Source/cmPolicies.h b/Source/cmPolicies.h
index 361d820..6834121 100644
--- a/Source/cmPolicies.h
+++ b/Source/cmPolicies.h
@@ -92,6 +92,8 @@ public:
/// should match a validity pattern.
CMP0038, ///< Targets may not link directly to themselves
CMP0039, ///< Utility targets may not have link dependencies
+ CMP0040, ///< The target in the TARGET signature of
+ /// add_custom_command() must exist.
/** \brief Always the last entry.
*
diff --git a/Source/cmQtAutoGenerators.cxx b/Source/cmQtAutoGenerators.cxx
index 36cb368..35717ce 100644
--- a/Source/cmQtAutoGenerators.cxx
+++ b/Source/cmQtAutoGenerators.cxx
@@ -257,7 +257,7 @@ bool cmQtAutoGenerators::InitializeAutogenTarget(cmTarget* target)
workingDirectory.c_str());
cc.SetEscapeOldStyle(false);
cc.SetEscapeAllowMakeVars(true);
- target->GetPreBuildCommands().push_back(cc);
+ target->AddPreBuildCommand(cc);
}
else
#endif
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index c9905b6..cf68e38 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -91,8 +91,8 @@ public:
}
~cmTargetInternals();
typedef cmTarget::SourceFileFlags SourceFileFlags;
- std::map<cmSourceFile const*, SourceFileFlags> SourceFlagsMap;
- bool SourceFileFlagsConstructed;
+ mutable std::map<cmSourceFile const*, SourceFileFlags> SourceFlagsMap;
+ mutable bool SourceFileFlagsConstructed;
// The backtrace when the target was created.
cmListFileBacktrace Backtrace;
@@ -438,7 +438,7 @@ bool cmTarget::IsExecutableWithExports() const
}
//----------------------------------------------------------------------------
-bool cmTarget::IsLinkable()
+bool cmTarget::IsLinkable() const
{
return (this->GetType() == cmTarget::STATIC_LIBRARY ||
this->GetType() == cmTarget::SHARED_LIBRARY ||
@@ -577,7 +577,7 @@ void cmTarget::ProcessSourceExpression(std::string const& expr)
//----------------------------------------------------------------------------
struct cmTarget::SourceFileFlags
-cmTarget::GetTargetSourceFileFlags(const cmSourceFile* sf)
+cmTarget::GetTargetSourceFileFlags(const cmSourceFile* sf) const
{
struct SourceFileFlags flags;
this->ConstructSourceFileFlags();
@@ -591,7 +591,7 @@ cmTarget::GetTargetSourceFileFlags(const cmSourceFile* sf)
}
//----------------------------------------------------------------------------
-void cmTarget::ConstructSourceFileFlags()
+void cmTarget::ConstructSourceFileFlags() const
{
if(this->Internal->SourceFileFlagsConstructed)
{
@@ -769,9 +769,9 @@ void cmTarget::ClearDependencyInformation( cmMakefile& mf,
}
//----------------------------------------------------------------------------
-bool cmTarget::NameResolvesToFramework(const std::string& libname)
+bool cmTarget::NameResolvesToFramework(const std::string& libname) const
{
- return this->GetMakefile()->GetLocalGenerator()->GetGlobalGenerator()->
+ return this->Makefile->GetLocalGenerator()->GetGlobalGenerator()->
NameResolvesToFramework(libname);
}
@@ -811,7 +811,7 @@ void cmTarget::GetDirectLinkLibraries(const char *config,
//----------------------------------------------------------------------------
void cmTarget::GetInterfaceLinkLibraries(const char *config,
- std::vector<std::string> &libs, cmTarget *head)
+ std::vector<std::string> &libs, cmTarget *head) const
{
const char *prop = this->GetProperty("INTERFACE_LINK_LIBRARIES");
if (prop)
@@ -834,7 +834,7 @@ void cmTarget::GetInterfaceLinkLibraries(const char *config,
//----------------------------------------------------------------------------
std::string cmTarget::GetDebugGeneratorExpressions(const std::string &value,
- cmTarget::LinkLibraryType llt)
+ cmTarget::LinkLibraryType llt) const
{
if (llt == GENERAL)
{
@@ -2276,7 +2276,7 @@ static void cmTargetCheckINTERFACE_LINK_LIBRARIES(const char* value,
}
//----------------------------------------------------------------------------
-void cmTarget::CheckProperty(const char* prop, cmMakefile* context)
+void cmTarget::CheckProperty(const char* prop, cmMakefile* context) const
{
// Certain properties need checking.
if(strncmp(prop, "LINK_INTERFACE_LIBRARIES", 24) == 0)
@@ -2382,7 +2382,7 @@ std::string cmTarget::GetDirectory(const char* config, bool implib) const
}
//----------------------------------------------------------------------------
-std::string cmTarget::GetPDBDirectory(const char* config)
+std::string cmTarget::GetPDBDirectory(const char* config) const
{
if(OutputInfo const* info = this->GetOutputInfo(config))
{
@@ -2453,7 +2453,7 @@ const char* cmTarget::NormalGetLocation(const char* config) const
}
//----------------------------------------------------------------------------
-void cmTarget::GetTargetVersion(int& major, int& minor)
+void cmTarget::GetTargetVersion(int& major, int& minor) const
{
int patch;
this->GetTargetVersion(false, major, minor, patch);
@@ -2461,7 +2461,7 @@ void cmTarget::GetTargetVersion(int& major, int& minor)
//----------------------------------------------------------------------------
void cmTarget::GetTargetVersion(bool soversion,
- int& major, int& minor, int& patch)
+ int& major, int& minor, int& patch) const
{
// Set the default values.
major = 0;
@@ -2489,7 +2489,7 @@ void cmTarget::GetTargetVersion(bool soversion,
}
//----------------------------------------------------------------------------
-const char* cmTarget::GetFeature(const char* feature, const char* config)
+const char* cmTarget::GetFeature(const char* feature, const char* config) const
{
if(config && *config)
{
@@ -3145,7 +3145,7 @@ bool cmTarget::HasMacOSXRpath(const char* config) const
}
//----------------------------------------------------------------------------
-bool cmTarget::IsImportedSharedLibWithoutSOName(const char* config)
+bool cmTarget::IsImportedSharedLibWithoutSOName(const char* config) const
{
if(this->IsImported() && this->GetType() == cmTarget::SHARED_LIBRARY)
{
@@ -3597,14 +3597,14 @@ void cmTarget::GetExecutableNames(std::string& name,
}
//----------------------------------------------------------------------------
-bool cmTarget::HasImplibGNUtoMS()
+bool cmTarget::HasImplibGNUtoMS() const
{
return this->HasImportLibrary() && this->GetPropertyAsBool("GNUtoMS");
}
//----------------------------------------------------------------------------
bool cmTarget::GetImplibGNUtoMS(std::string const& gnuName,
- std::string& out, const char* newExt)
+ std::string& out, const char* newExt) const
{
if(this->HasImplibGNUtoMS() &&
gnuName.size() > 6 && gnuName.substr(gnuName.size()-6) == ".dll.a")
@@ -3976,7 +3976,7 @@ bool cmTarget::ComputePDBOutputDir(const char* config, std::string& out) const
}
//----------------------------------------------------------------------------
-bool cmTarget::UsesDefaultOutputDir(const char* config, bool implib)
+bool cmTarget::UsesDefaultOutputDir(const char* config, bool implib) const
{
std::string dir;
return this->ComputeOutputDir(config, implib, dir);
@@ -4037,7 +4037,7 @@ std::string cmTarget::GetFrameworkVersion() const
}
//----------------------------------------------------------------------------
-const char* cmTarget::GetExportMacro()
+const char* cmTarget::GetExportMacro() const
{
// Define the symbol for targets that export symbols.
if(this->GetType() == cmTarget::SHARED_LIBRARY ||
diff --git a/Source/cmTarget.h b/Source/cmTarget.h
index b516a0a..35ec680 100644
--- a/Source/cmTarget.h
+++ b/Source/cmTarget.h
@@ -114,12 +114,18 @@ public:
/**
* Get the list of the custom commands for this target
*/
- std::vector<cmCustomCommand> &GetPreBuildCommands()
+ std::vector<cmCustomCommand> const &GetPreBuildCommands() const
{return this->PreBuildCommands;}
- std::vector<cmCustomCommand> &GetPreLinkCommands()
+ std::vector<cmCustomCommand> const &GetPreLinkCommands() const
{return this->PreLinkCommands;}
- std::vector<cmCustomCommand> &GetPostBuildCommands()
+ std::vector<cmCustomCommand> const &GetPostBuildCommands() const
{return this->PostBuildCommands;}
+ void AddPreBuildCommand(cmCustomCommand const &cmd)
+ {this->PreBuildCommands.push_back(cmd);}
+ void AddPreLinkCommand(cmCustomCommand const &cmd)
+ {this->PreLinkCommands.push_back(cmd);}
+ void AddPostBuildCommand(cmCustomCommand const &cmd)
+ {this->PostBuildCommands.push_back(cmd);}
/**
* Get the list of the source files used by this target
@@ -156,7 +162,8 @@ public:
/**
* Get the flags for a given source file as used in this target
*/
- struct SourceFileFlags GetTargetSourceFileFlags(const cmSourceFile* sf);
+ struct SourceFileFlags
+ GetTargetSourceFileFlags(const cmSourceFile* sf) const;
/**
* Add sources to the target.
@@ -179,7 +186,7 @@ public:
cmTarget const* head) const;
void GetInterfaceLinkLibraries(const char *config,
std::vector<std::string> &,
- cmTarget *head);
+ cmTarget *head) const;
/** Compute the link type to use for the given configuration. */
LinkLibraryType ComputeLinkType(const char* config) const;
@@ -190,7 +197,7 @@ public:
void ClearDependencyInformation(cmMakefile& mf, const char* target);
// Check to see if a library is a framework and treat it different on Mac
- bool NameResolvesToFramework(const std::string& libname);
+ bool NameResolvesToFramework(const std::string& libname) const;
void AddLinkLibrary(cmMakefile& mf,
const char *target, const char* lib,
LinkLibraryType llt);
@@ -212,14 +219,14 @@ public:
* Set the path where this target should be installed. This is relative to
* INSTALL_PREFIX
*/
- std::string GetInstallPath() {return this->InstallPath;}
+ std::string GetInstallPath() const {return this->InstallPath;}
void SetInstallPath(const char *name) {this->InstallPath = name;}
/**
* Set the path where this target (if it has a runtime part) should be
* installed. This is relative to INSTALL_PREFIX
*/
- std::string GetRuntimeInstallPath() {return this->RuntimeInstallPath;}
+ std::string GetRuntimeInstallPath() const {return this->RuntimeInstallPath;}
void SetRuntimeInstallPath(const char *name) {
this->RuntimeInstallPath = name; }
@@ -246,9 +253,9 @@ public:
const char *GetProperty(const char *prop) const;
const char *GetProperty(const char *prop, cmProperty::ScopeType scope) const;
bool GetPropertyAsBool(const char *prop) const;
- void CheckProperty(const char* prop, cmMakefile* context);
+ void CheckProperty(const char* prop, cmMakefile* context) const;
- const char* GetFeature(const char* feature, const char* config);
+ const char* GetFeature(const char* feature, const char* config) const;
bool IsImported() const {return this->IsImportedTarget;}
@@ -330,7 +337,7 @@ public:
If the configuration name is given then the generator will add its
subdirectory for that configuration. Otherwise just the canonical
pdb output directory is given. */
- std::string GetPDBDirectory(const char* config = 0);
+ std::string GetPDBDirectory(const char* config = 0) const;
/** Get the location of the target in the build tree for the given
configuration. This location is suitable for use as the LOCATION
@@ -340,12 +347,13 @@ public:
/** Get the target major and minor version numbers interpreted from
the VERSION property. Version 0 is returned if the property is
not set or cannot be parsed. */
- void GetTargetVersion(int& major, int& minor);
+ void GetTargetVersion(int& major, int& minor) const;
/** Get the target major, minor, and patch version numbers
interpreted from the VERSION or SOVERSION property. Version 0
is returned if the property is not set or cannot be parsed. */
- void GetTargetVersion(bool soversion, int& major, int& minor, int& patch);
+ void
+ GetTargetVersion(bool soversion, int& major, int& minor, int& patch) const;
/**
* Make sure the full path to all source files is known.
@@ -377,7 +385,7 @@ public:
/** Test for special case of a third-party shared library that has
no soname at all. */
- bool IsImportedSharedLibWithoutSOName(const char* config);
+ bool IsImportedSharedLibWithoutSOName(const char* config) const;
/** Get the full path to the target according to the settings in its
makefile and the configuration type. */
@@ -399,12 +407,12 @@ public:
std::string& pdbName, const char* config) const;
/** Does this target have a GNU implib to convert to MS format? */
- bool HasImplibGNUtoMS();
+ bool HasImplibGNUtoMS() const;
/** Convert the given GNU import library name (.dll.a) to a name with a new
extension (.lib or ${CMAKE_IMPORT_LIBRARY_SUFFIX}). */
bool GetImplibGNUtoMS(std::string const& gnuName, std::string& out,
- const char* newExt = 0);
+ const char* newExt = 0) const;
/**
* Compute whether this target must be relinked before installing.
@@ -442,7 +450,7 @@ public:
/** Get the macro to define when building sources in this target.
If no macro should be defined null is returned. */
- const char* GetExportMacro();
+ const char* GetExportMacro() const;
void GetCompileDefinitions(std::vector<std::string> &result,
const char *config) const;
@@ -459,10 +467,10 @@ public:
bool IsExecutableWithExports() const;
/** Return whether this target may be used to link another target. */
- bool IsLinkable();
+ bool IsLinkable() const;
/** Return whether or not the target is for a DLL platform. */
- bool IsDLLPlatform() { return this->DLLPlatform; }
+ bool IsDLLPlatform() const { return this->DLLPlatform; }
/** Return whether or not the target has a DLL import library. */
bool HasImportLibrary() const;
@@ -493,7 +501,7 @@ public:
/** Return whether this target uses the default value for its output
directory. */
- bool UsesDefaultOutputDir(const char* config, bool implib);
+ bool UsesDefaultOutputDir(const char* config, bool implib) const;
/** @return the mac content directory for this target. */
std::string GetMacContentDirectory(const char* config,
@@ -546,7 +554,7 @@ public:
const char *config) const;
std::string GetDebugGeneratorExpressions(const std::string &value,
- cmTarget::LinkLibraryType llt);
+ cmTarget::LinkLibraryType llt) const;
void AddSystemIncludeDirectories(const std::set<cmStdString> &incs);
void AddSystemIncludeDirectories(const std::vector<std::string> &incs);
@@ -671,7 +679,7 @@ private:
bool HaveInstallRule;
std::string InstallPath;
std::string RuntimeInstallPath;
- std::string ExportMacro;
+ mutable std::string ExportMacro;
std::set<cmStdString> Utilities;
bool RecordDependencies;
mutable cmPropertyMap Properties;
@@ -736,7 +744,7 @@ private:
friend class cmTargetTraceDependencies;
cmTargetInternalPointer Internal;
- void ConstructSourceFileFlags();
+ void ConstructSourceFileFlags() const;
void ComputeVersionedName(std::string& vName,
std::string const& prefix,
std::string const& base,
diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx
index ace1eef..635d8cb 100644
--- a/Source/cmVisualStudio10TargetGenerator.cxx
+++ b/Source/cmVisualStudio10TargetGenerator.cxx
@@ -1794,7 +1794,7 @@ cmVisualStudio10TargetGenerator::WriteEvents(std::string const& configName)
void cmVisualStudio10TargetGenerator::WriteEvent(
const char* name,
- std::vector<cmCustomCommand> & commands,
+ std::vector<cmCustomCommand> const& commands,
std::string const& configName)
{
if(commands.size() == 0)
@@ -1807,10 +1807,10 @@ void cmVisualStudio10TargetGenerator::WriteEvent(
std::string script;
const char* pre = "";
std::string comment;
- for(std::vector<cmCustomCommand>::iterator i = commands.begin();
+ for(std::vector<cmCustomCommand>::const_iterator i = commands.begin();
i != commands.end(); ++i)
{
- cmCustomCommand& command = *i;
+ const cmCustomCommand& command = *i;
comment += pre;
comment += lg->ConstructComment(command);
script += pre;
diff --git a/Source/cmVisualStudio10TargetGenerator.h b/Source/cmVisualStudio10TargetGenerator.h
index 9a480a8..d1f3d19 100644
--- a/Source/cmVisualStudio10TargetGenerator.h
+++ b/Source/cmVisualStudio10TargetGenerator.h
@@ -87,7 +87,8 @@ private:
void AddLibraries(cmComputeLinkInformation& cli, std::string& libstring);
void WriteLibOptions(std::string const& config);
void WriteEvents(std::string const& configName);
- void WriteEvent(const char* name, std::vector<cmCustomCommand> & commands,
+ void WriteEvent(const char* name,
+ std::vector<cmCustomCommand> const& commands,
std::string const& configName);
void WriteGroupSources(const char* name, ToolSources const& sources,
std::vector<cmSourceGroup>& );