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