cmCPackPropertiesGenerator.cxx 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. #include "cmCPackPropertiesGenerator.h"
  2. #include "cmOutputConverter.h"
  3. cmCPackPropertiesGenerator::cmCPackPropertiesGenerator(
  4. cmMakefile* mf,
  5. cmInstalledFile const& installedFile,
  6. std::vector<std::string> const& configurations):
  7. cmScriptGenerator("CPACK_BUILD_CONFIG", configurations),
  8. Makefile(mf),
  9. InstalledFile(installedFile)
  10. {
  11. this->ActionsPerConfig = true;
  12. }
  13. void cmCPackPropertiesGenerator::GenerateScriptForConfig(std::ostream& os,
  14. const std::string& config, Indent const& indent)
  15. {
  16. std::string const& expandedFileName =
  17. this->InstalledFile.GetNameExpression().Evaluate(this->Makefile, config);
  18. cmInstalledFile::PropertyMapType const& properties =
  19. this->InstalledFile.GetProperties();
  20. for(cmInstalledFile::PropertyMapType::const_iterator i = properties.begin();
  21. i != properties.end(); ++i)
  22. {
  23. std::string const& name = i->first;
  24. cmInstalledFile::Property const& property = i->second;
  25. os << indent << "set_property(INSTALL " <<
  26. cmOutputConverter::EscapeForCMake(expandedFileName) << " PROPERTY " <<
  27. cmOutputConverter::EscapeForCMake(name);
  28. for(cmInstalledFile::ExpressionVectorType::const_iterator
  29. j = property.ValueExpressions.begin();
  30. j != property.ValueExpressions.end(); ++j)
  31. {
  32. std::string value = (*j)->Evaluate(this->Makefile, config);
  33. os << " " << cmOutputConverter::EscapeForCMake(value);
  34. }
  35. os << ")\n";
  36. }
  37. }