2014-05-15 17:12:40 +00:00
|
|
|
#include "cmCPackPropertiesGenerator.h"
|
|
|
|
|
2016-08-17 22:24:24 +00:00
|
|
|
#include "cmGeneratorExpression.h"
|
|
|
|
#include "cmInstalledFile.h"
|
2016-04-29 14:53:13 +00:00
|
|
|
#include "cmOutputConverter.h"
|
2014-05-15 17:12:40 +00:00
|
|
|
|
2016-08-17 22:24:24 +00:00
|
|
|
#include <map>
|
|
|
|
#include <ostream>
|
|
|
|
#include <utility>
|
|
|
|
|
2014-05-15 17:12:40 +00:00
|
|
|
cmCPackPropertiesGenerator::cmCPackPropertiesGenerator(
|
2016-05-16 14:34:04 +00:00
|
|
|
cmLocalGenerator* lg, cmInstalledFile const& installedFile,
|
|
|
|
std::vector<std::string> const& configurations)
|
|
|
|
: cmScriptGenerator("CPACK_BUILD_CONFIG", configurations)
|
|
|
|
, LG(lg)
|
|
|
|
, InstalledFile(installedFile)
|
2014-05-15 17:12:40 +00:00
|
|
|
{
|
|
|
|
this->ActionsPerConfig = true;
|
|
|
|
}
|
|
|
|
|
2016-05-16 14:34:04 +00:00
|
|
|
void cmCPackPropertiesGenerator::GenerateScriptForConfig(
|
|
|
|
std::ostream& os, const std::string& config, Indent const& indent)
|
2014-05-15 17:12:40 +00:00
|
|
|
{
|
|
|
|
std::string const& expandedFileName =
|
2016-05-16 14:34:04 +00:00
|
|
|
this->InstalledFile.GetNameExpression().Evaluate(this->LG, config);
|
2014-05-15 17:12:40 +00:00
|
|
|
|
|
|
|
cmInstalledFile::PropertyMapType const& properties =
|
|
|
|
this->InstalledFile.GetProperties();
|
|
|
|
|
2016-05-16 14:34:04 +00:00
|
|
|
for (cmInstalledFile::PropertyMapType::const_iterator i = properties.begin();
|
|
|
|
i != properties.end(); ++i) {
|
2014-05-15 17:12:40 +00:00
|
|
|
std::string const& name = i->first;
|
|
|
|
cmInstalledFile::Property const& property = i->second;
|
|
|
|
|
2016-05-16 14:34:04 +00:00
|
|
|
os << indent << "set_property(INSTALL "
|
|
|
|
<< cmOutputConverter::EscapeForCMake(expandedFileName) << " PROPERTY "
|
|
|
|
<< cmOutputConverter::EscapeForCMake(name);
|
2014-05-15 17:12:40 +00:00
|
|
|
|
2016-05-16 14:34:04 +00:00
|
|
|
for (cmInstalledFile::ExpressionVectorType::const_iterator j =
|
|
|
|
property.ValueExpressions.begin();
|
|
|
|
j != property.ValueExpressions.end(); ++j) {
|
2015-07-25 14:56:52 +00:00
|
|
|
std::string value = (*j)->Evaluate(this->LG, config);
|
2015-05-15 22:55:21 +00:00
|
|
|
os << " " << cmOutputConverter::EscapeForCMake(value);
|
2016-05-16 14:34:04 +00:00
|
|
|
}
|
2014-05-15 17:12:40 +00:00
|
|
|
|
|
|
|
os << ")\n";
|
2016-05-16 14:34:04 +00:00
|
|
|
}
|
2014-05-15 17:12:40 +00:00
|
|
|
}
|