summaryrefslogtreecommitdiff
path: root/Source
diff options
context:
space:
mode:
authorNils Gladitz <nilsgladitz@gmail.com>2014-05-15 19:12:40 +0200
committerBrad King <brad.king@kitware.com>2014-05-28 12:28:18 -0400
commit15a8af21e8bd8354dfff2063e01f695f85efdeb8 (patch)
treeb7d98cab3ba63f61074a4f63a250934f0294826a /Source
parent032961c6ac81d82270a7b1986935111aa5e32a56 (diff)
downloadcmake-15a8af21e8bd8354dfff2063e01f695f85efdeb8.tar.gz
Add an "installed file" property scope
Teach set_property and get_property an "INSTALL" property type to be associated with install-tree file paths. Make the properties available to CPack for use during packaging. Add a "prop_inst" Sphinx domain object type for documentation of such properties.
Diffstat (limited to 'Source')
-rw-r--r--Source/CMakeLists.txt4
-rw-r--r--Source/CPack/cmCPackGenerator.cxx8
-rw-r--r--Source/CPack/cmCPackGenerator.h3
-rw-r--r--Source/CPack/cpack.cxx9
-rw-r--r--Source/cmCPackPropertiesGenerator.cxx45
-rw-r--r--Source/cmCPackPropertiesGenerator.h38
-rw-r--r--Source/cmGetPropertyCommand.cxx37
-rw-r--r--Source/cmGetPropertyCommand.h1
-rw-r--r--Source/cmGlobalGenerator.cxx44
-rw-r--r--Source/cmGlobalGenerator.h2
-rw-r--r--Source/cmInstalledFile.cxx115
-rw-r--r--Source/cmInstalledFile.h83
-rw-r--r--Source/cmProperty.h2
-rw-r--r--Source/cmRST.cxx3
-rw-r--r--Source/cmSetPropertyCommand.cxx59
-rw-r--r--Source/cmSetPropertyCommand.h2
-rw-r--r--Source/cmake.cxx35
-rw-r--r--Source/cmake.h12
18 files changed, 494 insertions, 8 deletions
diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt
index 660c0c5045..8ecf83c489 100644
--- a/Source/CMakeLists.txt
+++ b/Source/CMakeLists.txt
@@ -163,6 +163,8 @@ set(SRCS
cmComputeLinkInformation.h
cmComputeTargetDepends.h
cmComputeTargetDepends.cxx
+ cmCPackPropertiesGenerator.h
+ cmCPackPropertiesGenerator.cxx
cmCryptoHash.cxx
cmCryptoHash.h
cmCustomCommand.cxx
@@ -243,6 +245,8 @@ set(SRCS
cmInstallGenerator.h
cmInstallGenerator.cxx
cmInstallExportGenerator.cxx
+ cmInstalledFile.h
+ cmInstalledFile.cxx
cmInstallFilesGenerator.h
cmInstallFilesGenerator.cxx
cmInstallScriptGenerator.h
diff --git a/Source/CPack/cmCPackGenerator.cxx b/Source/CPack/cmCPackGenerator.cxx
index 9cdf5aad92..91f92c5554 100644
--- a/Source/CPack/cmCPackGenerator.cxx
+++ b/Source/CPack/cmCPackGenerator.cxx
@@ -1314,6 +1314,14 @@ int cmCPackGenerator::CleanTemporaryDirectory()
}
//----------------------------------------------------------------------
+cmInstalledFile const* cmCPackGenerator::GetInstalledFile(
+ std::string const& name) const
+{
+ cmake const* cm = this->MakefileMap->GetCMakeInstance();
+ return cm->GetInstalledFile(name);
+}
+
+//----------------------------------------------------------------------
int cmCPackGenerator::PrepareGroupingKind()
{
// find a component package method specified by the user
diff --git a/Source/CPack/cmCPackGenerator.h b/Source/CPack/cmCPackGenerator.h
index e780f0e64b..ed89b53a84 100644
--- a/Source/CPack/cmCPackGenerator.h
+++ b/Source/CPack/cmCPackGenerator.h
@@ -47,6 +47,7 @@
class cmMakefile;
class cmCPackLog;
+class cmInstalledFile;
/** \class cmCPackGenerator
* \brief A superclass of all CPack Generators
@@ -129,6 +130,8 @@ protected:
int CleanTemporaryDirectory();
+ cmInstalledFile const* GetInstalledFile(std::string const& name) const;
+
virtual const char* GetOutputExtension() { return ".cpack"; }
virtual const char* GetOutputPostfix() { return 0; }
diff --git a/Source/CPack/cpack.cxx b/Source/CPack/cpack.cxx
index 9eabdcae56..2aa599131c 100644
--- a/Source/CPack/cpack.cxx
+++ b/Source/CPack/cpack.cxx
@@ -257,6 +257,11 @@ int main (int argc, char const* const* argv)
return 1;
}
+ if ( !cpackBuildConfig.empty() )
+ {
+ globalMF->AddDefinition("CPACK_BUILD_CONFIG", cpackBuildConfig.c_str());
+ }
+
if ( cmSystemTools::FileExists(cpackConfigFile.c_str()) )
{
cpackConfigFile =
@@ -317,10 +322,6 @@ int main (int argc, char const* const* argv)
cpackProjectDirectory.c_str());
}
}
- if ( !cpackBuildConfig.empty() )
- {
- globalMF->AddDefinition("CPACK_BUILD_CONFIG", cpackBuildConfig.c_str());
- }
cpackDefinitions::MapType::iterator cdit;
for ( cdit = definitions.Map.begin();
cdit != definitions.Map.end();
diff --git a/Source/cmCPackPropertiesGenerator.cxx b/Source/cmCPackPropertiesGenerator.cxx
new file mode 100644
index 0000000000..cf24c136f6
--- /dev/null
+++ b/Source/cmCPackPropertiesGenerator.cxx
@@ -0,0 +1,45 @@
+#include "cmCPackPropertiesGenerator.h"
+
+#include "cmLocalGenerator.h"
+
+cmCPackPropertiesGenerator::cmCPackPropertiesGenerator(
+ cmMakefile* mf,
+ cmInstalledFile const& installedFile,
+ std::vector<std::string> const& configurations):
+ cmScriptGenerator("CPACK_BUILD_CONFIG", configurations),
+ Makefile(mf),
+ InstalledFile(installedFile)
+{
+ this->ActionsPerConfig = true;
+}
+
+void cmCPackPropertiesGenerator::GenerateScriptForConfig(std::ostream& os,
+ const std::string& config, Indent const& indent)
+{
+ std::string const& expandedFileName =
+ this->InstalledFile.GetNameExpression().Evaluate(this->Makefile, config);
+
+ cmInstalledFile::PropertyMapType const& properties =
+ this->InstalledFile.GetProperties();
+
+ for(cmInstalledFile::PropertyMapType::const_iterator i = properties.begin();
+ i != properties.end(); ++i)
+ {
+ std::string const& name = i->first;
+ cmInstalledFile::Property const& property = i->second;
+
+ os << indent << "set_property(INSTALL " <<
+ cmLocalGenerator::EscapeForCMake(expandedFileName) << " PROPERTY " <<
+ cmLocalGenerator::EscapeForCMake(name);
+
+ for(cmInstalledFile::ExpressionVectorType::const_iterator
+ j = property.ValueExpressions.begin();
+ j != property.ValueExpressions.end(); ++j)
+ {
+ std::string value = (*j)->Evaluate(this->Makefile, config);
+ os << " " << cmLocalGenerator::EscapeForCMake(value);
+ }
+
+ os << ")\n";
+ }
+}
diff --git a/Source/cmCPackPropertiesGenerator.h b/Source/cmCPackPropertiesGenerator.h
new file mode 100644
index 0000000000..71e2eaa425
--- /dev/null
+++ b/Source/cmCPackPropertiesGenerator.h
@@ -0,0 +1,38 @@
+/*============================================================================
+ CMake - Cross Platform Makefile Generator
+ Copyright 2014 Kitware, Inc., Insight Software Consortium
+
+ Distributed under the OSI-approved BSD License (the "License");
+ see accompanying file Copyright.txt for details.
+
+ This software is distributed WITHOUT ANY WARRANTY; without even the
+ implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ See the License for more information.
+============================================================================*/
+#ifndef cmCPackPropertiesGenerator_h
+#define cmCPackPropertiesGenerator_h
+
+#include "cmScriptGenerator.h"
+#include "cmInstalledFile.h"
+
+/** \class cmCPackPropertiesGenerator
+ * \brief Support class for generating CPackProperties.cmake.
+ *
+ */
+class cmCPackPropertiesGenerator: public cmScriptGenerator
+{
+public:
+ cmCPackPropertiesGenerator(
+ cmMakefile* mf,
+ cmInstalledFile const& installedFile,
+ std::vector<std::string> const& configurations);
+
+protected:
+ virtual void GenerateScriptForConfig(std::ostream& os,
+ const std::string& config, Indent const& indent);
+
+ cmMakefile* Makefile;
+ cmInstalledFile const& InstalledFile;
+};
+
+#endif
diff --git a/Source/cmGetPropertyCommand.cxx b/Source/cmGetPropertyCommand.cxx
index 512d78994c..9a88191f41 100644
--- a/Source/cmGetPropertyCommand.cxx
+++ b/Source/cmGetPropertyCommand.cxx
@@ -67,12 +67,16 @@ bool cmGetPropertyCommand
{
scope = cmProperty::CACHE;
}
+ else if(args[1] == "INSTALL")
+ {
+ scope = cmProperty::INSTALL;
+ }
else
{
cmOStringStream e;
e << "given invalid scope " << args[1] << ". "
<< "Valid scopes are "
- << "GLOBAL, DIRECTORY, TARGET, SOURCE, TEST, VARIABLE, CACHE.";
+ << "GLOBAL, DIRECTORY, TARGET, SOURCE, TEST, VARIABLE, CACHE, INSTALL.";
this->SetError(e.str());
return false;
}
@@ -190,6 +194,7 @@ bool cmGetPropertyCommand
case cmProperty::TEST: return this->HandleTestMode();
case cmProperty::VARIABLE: return this->HandleVariableMode();
case cmProperty::CACHE: return this->HandleCacheMode();
+ case cmProperty::INSTALL: return this->HandleInstallMode();
case cmProperty::CACHED_VARIABLE:
break; // should never happen
@@ -395,3 +400,33 @@ bool cmGetPropertyCommand::HandleCacheMode()
this->StoreResult(value);
return true;
}
+
+//----------------------------------------------------------------------------
+bool cmGetPropertyCommand::HandleInstallMode()
+{
+ if(this->Name.empty())
+ {
+ this->SetError("not given name for INSTALL scope.");
+ return false;
+ }
+
+ // Get the installed file.
+ cmake* cm = this->Makefile->GetCMakeInstance();
+
+ if(cmInstalledFile* file = cm->GetOrCreateInstalledFile(
+ this->Makefile, this->Name))
+ {
+ std::string value;
+ bool isSet = file->GetProperty(this->PropertyName, value);
+
+ return this->StoreResult(isSet ? value.c_str() : 0);
+ }
+ else
+ {
+ cmOStringStream e;
+ e << "given INSTALL name that could not be found or created: "
+ << this->Name;
+ this->SetError(e.str());
+ return false;
+ }
+}
diff --git a/Source/cmGetPropertyCommand.h b/Source/cmGetPropertyCommand.h
index 8c3738fbd3..40b7dbc009 100644
--- a/Source/cmGetPropertyCommand.h
+++ b/Source/cmGetPropertyCommand.h
@@ -60,6 +60,7 @@ private:
bool HandleTestMode();
bool HandleVariableMode();
bool HandleCacheMode();
+ bool HandleInstallMode();
};
#endif
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx
index 2a30593cc3..dba4f46790 100644
--- a/Source/cmGlobalGenerator.cxx
+++ b/Source/cmGlobalGenerator.cxx
@@ -28,6 +28,7 @@
#include "cmGeneratorExpression.h"
#include "cmGeneratorExpressionEvaluationFile.h"
#include "cmExportBuildFileGenerator.h"
+#include "cmCPackPropertiesGenerator.h"
#include <cmsys/Directory.hxx>
#include <cmsys/FStream.hxx>
@@ -1269,6 +1270,13 @@ void cmGlobalGenerator::Generate()
}
this->SetCurrentLocalGenerator(0);
+ if(!this->GenerateCPackPropertiesFile())
+ {
+ this->GetCMakeInstance()->IssueMessage(
+ cmake::FATAL_ERROR, "Could not write CPack properties file.",
+ cmListFileBacktrace());
+ }
+
for (std::map<std::string, cmExportBuildFileGenerator*>::iterator
it = this->BuildExportSets.begin(); it != this->BuildExportSets.end();
++it)
@@ -3014,3 +3022,39 @@ std::string cmGlobalGenerator::ExpandCFGIntDir(const std::string& str,
{
return str;
}
+
+//----------------------------------------------------------------------------
+bool cmGlobalGenerator::GenerateCPackPropertiesFile()
+{
+ cmake::InstalledFilesMap const& installedFiles =
+ this->CMakeInstance->GetInstalledFiles();
+
+ cmMakefile* mf = this->LocalGenerators[0]->GetMakefile();
+
+ std::vector<std::string> configs;
+ std::string config = mf->GetConfigurations(configs, false);
+
+ std::string path = this->CMakeInstance->GetStartOutputDirectory();
+ path += "/CPackProperties.cmake";
+
+ if(!cmSystemTools::FileExists(path.c_str()) && installedFiles.empty())
+ {
+ return true;
+ }
+
+ cmGeneratedFileStream file(path.c_str());
+ file << "# CPack properties\n";
+
+ for(cmake::InstalledFilesMap::const_iterator i = installedFiles.begin();
+ i != installedFiles.end(); ++i)
+ {
+ cmInstalledFile const& installedFile = i->second;
+
+ cmCPackPropertiesGenerator cpackPropertiesGenerator(
+ mf, installedFile, configs);
+
+ cpackPropertiesGenerator.Generate(file, config, configs);
+ }
+
+ return true;
+}
diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h
index 14ec99a9f1..617e708c44 100644
--- a/Source/cmGlobalGenerator.h
+++ b/Source/cmGlobalGenerator.h
@@ -329,6 +329,8 @@ public:
virtual void ComputeTargetObjectDirectory(cmGeneratorTarget* gt) const;
+ bool GenerateCPackPropertiesFile();
+
protected:
typedef std::vector<cmLocalGenerator*> GeneratorVector;
// for a project collect all its targets by following depend
diff --git a/Source/cmInstalledFile.cxx b/Source/cmInstalledFile.cxx
new file mode 100644
index 0000000000..7e78ec000d
--- /dev/null
+++ b/Source/cmInstalledFile.cxx
@@ -0,0 +1,115 @@
+/*============================================================================
+ CMake - Cross Platform Makefile Generator
+ Copyright 2014 Kitware, Inc., Insight Software Consortium
+
+ Distributed under the OSI-approved BSD License (the "License");
+ see accompanying file Copyright.txt for details.
+
+ This software is distributed WITHOUT ANY WARRANTY; without even the
+ implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ See the License for more information.
+============================================================================*/
+#include "cmInstalledFile.h"
+#include "cmSystemTools.h"
+#include "cmMakefile.h"
+
+//----------------------------------------------------------------------------
+cmInstalledFile::cmInstalledFile():
+ NameExpression(0)
+{
+
+}
+
+//----------------------------------------------------------------------------
+cmInstalledFile::~cmInstalledFile()
+{
+ if(NameExpression)
+ {
+ delete NameExpression;
+ }
+}
+
+//----------------------------------------------------------------------------
+void cmInstalledFile::SetName(cmMakefile* mf, const std::string& name)
+{
+ cmListFileBacktrace backtrace;
+ mf->GetBacktrace(backtrace);
+ cmGeneratorExpression ge(backtrace);
+
+ this->Name = name;
+ this->NameExpression = ge.Parse(name).release();
+}
+
+//----------------------------------------------------------------------------
+std::string const& cmInstalledFile::GetName() const
+{
+ return this->Name;
+}
+
+//----------------------------------------------------------------------------
+cmCompiledGeneratorExpression const& cmInstalledFile::GetNameExpression() const
+{
+ return *(this->NameExpression);
+}
+
+//----------------------------------------------------------------------------
+void cmInstalledFile::RemoveProperty(const std::string& prop)
+{
+ this->Properties.erase(prop);
+}
+
+//----------------------------------------------------------------------------
+void cmInstalledFile::SetProperty(cmMakefile const* mf,
+ const std::string& prop, const char* value)
+{
+ this->RemoveProperty(prop);
+ this->AppendProperty(mf, prop, value);
+}
+
+//----------------------------------------------------------------------------
+void cmInstalledFile::AppendProperty(cmMakefile const* mf,
+ const std::string& prop, const char* value, bool /*asString*/)
+{
+ cmListFileBacktrace backtrace;
+ mf->GetBacktrace(backtrace);
+ cmGeneratorExpression ge(backtrace);
+
+ Property& property = this->Properties[prop];
+ property.ValueExpressions.push_back(ge.Parse(value).release());
+}
+
+//----------------------------------------------------------------------------
+bool cmInstalledFile::GetProperty(
+ const std::string& prop, std::string& value) const
+{
+ PropertyMapType::const_iterator i = this->Properties.find(prop);
+ if(i == this->Properties.end())
+ {
+ return false;
+ }
+
+ Property const& property = i->second;
+
+ std::string output;
+ std::string separator;
+
+ for(ExpressionVectorType::const_iterator
+ j = property.ValueExpressions.begin();
+ j != property.ValueExpressions.end(); ++j)
+ {
+ output += separator;
+ output += (*j)->GetInput();
+ separator = ";";
+ }
+
+ value = output;
+ return true;
+}
+
+//----------------------------------------------------------------------------
+bool cmInstalledFile::GetPropertyAsBool(const std::string& prop) const
+{
+ std::string value;
+ bool isSet = this->GetProperty(prop, value);
+ return isSet && cmSystemTools::IsOn(value.c_str());
+}
diff --git a/Source/cmInstalledFile.h b/Source/cmInstalledFile.h
new file mode 100644
index 0000000000..df28221bca
--- /dev/null
+++ b/Source/cmInstalledFile.h
@@ -0,0 +1,83 @@
+/*============================================================================
+ CMake - Cross Platform Makefile Generator
+ Copyright 2014 Kitware, Inc., Insight Software Consortium
+
+ Distributed under the OSI-approved BSD License (the "License");
+ see accompanying file Copyright.txt for details.
+
+ This software is distributed WITHOUT ANY WARRANTY; without even the
+ implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ See the License for more information.
+============================================================================*/
+#ifndef cmInstalledFile_h
+#define cmInstalledFile_h
+
+#include "cmGeneratorExpression.h"
+
+/** \class cmInstalledFile
+ * \brief Represents a file intended for installation.
+ *
+ * cmInstalledFile represents a file intended for installation.
+ */
+class cmInstalledFile
+{
+public:
+
+ typedef cmsys::auto_ptr<cmCompiledGeneratorExpression>
+ CompiledGeneratorExpressionPtrType;
+
+ typedef std::vector<cmCompiledGeneratorExpression*>
+ ExpressionVectorType;
+
+ struct Property
+ {
+ Property()
+ {
+
+ }
+
+ ~Property()
+ {
+ for(ExpressionVectorType::iterator i = ValueExpressions.begin();
+ i != ValueExpressions.end(); ++i)
+ {
+ delete *i;
+ }
+ }
+
+ ExpressionVectorType ValueExpressions;
+ };
+
+ typedef std::map<std::string, Property> PropertyMapType;
+
+ cmInstalledFile();
+
+ ~cmInstalledFile();
+
+ void RemoveProperty(const std::string& prop);
+
+ void SetProperty(cmMakefile const* mf,
+ const std::string& prop, const char *value);
+
+ void AppendProperty(cmMakefile const* mf,
+ const std::string& prop, const char* value,bool asString=false);
+
+ bool GetProperty(const std::string& prop, std::string& value) const;
+
+ bool GetPropertyAsBool(const std::string& prop) const;
+
+ void SetName(cmMakefile* mf, const std::string& name);
+
+ std::string const& GetName() const;
+
+ cmCompiledGeneratorExpression const& GetNameExpression() const;
+
+ PropertyMapType const& GetProperties() const { return this->Properties; }
+
+private:
+ std::string Name;
+ cmCompiledGeneratorExpression* NameExpression;
+ PropertyMapType Properties;
+};
+
+#endif
diff --git a/Source/cmProperty.h b/Source/cmProperty.h
index 34897e8994..659c4c3243 100644
--- a/Source/cmProperty.h
+++ b/Source/cmProperty.h
@@ -18,7 +18,7 @@ class cmProperty
{
public:
enum ScopeType { TARGET, SOURCE_FILE, DIRECTORY, GLOBAL, CACHE,
- TEST, VARIABLE, CACHED_VARIABLE };
+ TEST, VARIABLE, CACHED_VARIABLE, INSTALL };
// set this property
void Set(const std::string& name, const char *value);
diff --git a/Source/cmRST.cxx b/Source/cmRST.cxx
index 7ff12dde63..cca995b120 100644
--- a/Source/cmRST.cxx
+++ b/Source/cmRST.cxx
@@ -39,7 +39,8 @@ cmRST::cmRST(std::ostream& os, std::string const& docroot):
ModuleRST("^#\\[(=*)\\[\\.rst:$"),
CMakeRole("(:cmake)?:("
"command|generator|variable|module|policy|"
- "prop_cache|prop_dir|prop_gbl|prop_sf|prop_test|prop_tgt|"
+ "prop_cache|prop_dir|prop_gbl|prop_inst|prop_sf|"
+ "prop_test|prop_tgt|"
"manual"
"):`(<*([^`<]|[^` \t]<)*)([ \t]+<[^`]*>)?`"),
Substitution("(^|[^A-Za-z0-9_])"
diff --git a/Source/cmSetPropertyCommand.cxx b/Source/cmSetPropertyCommand.cxx
index 5f970f82a8..c624d170ad 100644
--- a/Source/cmSetPropertyCommand.cxx
+++ b/Source/cmSetPropertyCommand.cxx
@@ -61,11 +61,16 @@ bool cmSetPropertyCommand
{
scope = cmProperty::CACHE;
}
+ else if(*arg == "INSTALL")
+ {
+ scope = cmProperty::INSTALL;
+ }
else
{
cmOStringStream e;
e << "given invalid scope " << *arg << ". "
- << "Valid scopes are GLOBAL, DIRECTORY, TARGET, SOURCE, TEST, CACHE.";
+ << "Valid scopes are GLOBAL, DIRECTORY, "
+ "TARGET, SOURCE, TEST, CACHE, INSTALL.";
this->SetError(e.str());
return false;
}
@@ -135,6 +140,7 @@ bool cmSetPropertyCommand
case cmProperty::SOURCE_FILE: return this->HandleSourceMode();
case cmProperty::TEST: return this->HandleTestMode();
case cmProperty::CACHE: return this->HandleCacheMode();
+ case cmProperty::INSTALL: return this->HandleInstallMode();
case cmProperty::VARIABLE:
case cmProperty::CACHED_VARIABLE:
@@ -488,3 +494,54 @@ bool cmSetPropertyCommand::HandleCacheEntry(cmCacheManager::CacheIterator& it)
return true;
}
+
+//----------------------------------------------------------------------------
+bool cmSetPropertyCommand::HandleInstallMode()
+{
+ cmake* cm = this->Makefile->GetCMakeInstance();
+
+ for(std::set<std::string>::const_iterator i = this->Names.begin();
+ i != this->Names.end(); ++i)
+ {
+ if(cmInstalledFile* file = cm->GetOrCreateInstalledFile(
+ this->Makefile, *i))
+ {
+ if(!this->HandleInstall(file))
+ {
+ return false;
+ }
+ }
+ else
+ {
+ cmOStringStream e;
+ e << "given INSTALL name that could not be found or created: " << *i;
+ this->SetError(e.str());
+ return false;
+ }
+ }
+ return true;
+}
+
+//----------------------------------------------------------------------------
+bool cmSetPropertyCommand::HandleInstall(cmInstalledFile* file)
+{
+ // Set or append the property.
+ std::string const& name = this->PropertyName;
+
+ cmMakefile* mf = this->Makefile;
+
+ const char *value = this->PropertyValue.c_str();
+ if (this->Remove)
+ {
+ file->RemoveProperty(name);
+ }
+ else if(this->AppendMode)
+ {
+ file->AppendProperty(mf, name, value, this->AppendAsString);
+ }
+ else
+ {
+ file->SetProperty(mf, name, value);
+ }
+ return true;
+}
diff --git a/Source/cmSetPropertyCommand.h b/Source/cmSetPropertyCommand.h
index eaa023362f..b06cb6857e 100644
--- a/Source/cmSetPropertyCommand.h
+++ b/Source/cmSetPropertyCommand.h
@@ -62,6 +62,8 @@ private:
bool HandleTest(cmTest* test);
bool HandleCacheMode();
bool HandleCacheEntry(cmCacheManager::CacheIterator&);
+ bool HandleInstallMode();
+ bool HandleInstall(cmInstalledFile* file);
};
diff --git a/Source/cmake.cxx b/Source/cmake.cxx
index 3e789901d2..86652d3a38 100644
--- a/Source/cmake.cxx
+++ b/Source/cmake.cxx
@@ -2287,6 +2287,41 @@ bool cmake::GetPropertyAsBool(const std::string& prop)
return cmSystemTools::IsOn(this->GetProperty(prop));
}
+cmInstalledFile *cmake::GetOrCreateInstalledFile(
+ cmMakefile* mf, const std::string& name)
+{
+ std::map<std::string, cmInstalledFile>::iterator i =
+ this->InstalledFiles.find(name);
+
+ if(i != this->InstalledFiles.end())
+ {
+ cmInstalledFile &file = i->second;
+ return &file;
+ }
+ else
+ {
+ cmInstalledFile &file = this->InstalledFiles[name];
+ file.SetName(mf, name);
+ return &file;
+ }
+}
+
+cmInstalledFile const* cmake::GetInstalledFile(const std::string& name) const
+{
+ std::map<std::string, cmInstalledFile>::const_iterator i =
+ this->InstalledFiles.find(name);
+
+ if(i != this->InstalledFiles.end())
+ {
+ cmInstalledFile const& file = i->second;
+ return &file;
+ }
+ else
+ {
+ return 0;
+ }
+}
+
int cmake::GetSystemInformation(std::vector<std::string>& args)
{
// so create the directory
diff --git a/Source/cmake.h b/Source/cmake.h
index 33b4f74b64..0034e85363 100644
--- a/Source/cmake.h
+++ b/Source/cmake.h
@@ -16,6 +16,7 @@
#include "cmSystemTools.h"
#include "cmPropertyDefinitionMap.h"
#include "cmPropertyMap.h"
+#include "cmInstalledFile.h"
class cmGlobalGeneratorFactory;
class cmGlobalGenerator;
@@ -92,6 +93,7 @@ class cmake
FIND_PACKAGE_MODE
};
typedef std::map<std::string, cmCommand*> RegisteredCommandsMap;
+ typedef std::map<std::string, cmInstalledFile> InstalledFilesMap;
/// Default constructor
cmake();
@@ -280,6 +282,15 @@ class cmake
// Get the properties
cmPropertyMap &GetProperties() { return this->Properties; }
+ ///! Get or create an cmInstalledFile instance and return a pointer to it
+ cmInstalledFile *GetOrCreateInstalledFile(
+ cmMakefile* mf, const std::string& name);
+
+ cmInstalledFile const* GetInstalledFile(const std::string& name) const;
+
+ InstalledFilesMap const& GetInstalledFiles() const
+ { return this->InstalledFiles; }
+
///! Do all the checks before running configure
int DoPreConfigureChecks();
@@ -445,6 +456,7 @@ private:
cmFileTimeComparison* FileComparison;
std::string GraphVizFile;
std::vector<std::string> DebugConfigs;
+ InstalledFilesMap InstalledFiles;
void UpdateConversionPathTable();
};