cmInstallScriptGenerator.cxx 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. /*============================================================================
  2. CMake - Cross Platform Makefile Generator
  3. Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
  4. Distributed under the OSI-approved BSD License (the "License");
  5. see accompanying file Copyright.txt for details.
  6. This software is distributed WITHOUT ANY WARRANTY; without even the
  7. implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  8. See the License for more information.
  9. ============================================================================*/
  10. #include "cmInstallScriptGenerator.h"
  11. //----------------------------------------------------------------------------
  12. cmInstallScriptGenerator
  13. ::cmInstallScriptGenerator(const char* script, bool code,
  14. const char* component, bool exclude_from_all) :
  15. cmInstallGenerator(0, std::vector<std::string>(), component, MessageDefault,
  16. exclude_from_all),
  17. Script(script), Code(code)
  18. {
  19. }
  20. //----------------------------------------------------------------------------
  21. cmInstallScriptGenerator
  22. ::~cmInstallScriptGenerator()
  23. {
  24. }
  25. //----------------------------------------------------------------------------
  26. void cmInstallScriptGenerator::GenerateScript(std::ostream& os)
  27. {
  28. Indent indent;
  29. std::string component_test =
  30. this->CreateComponentTest(this->Component.c_str(), this->ExcludeFromAll);
  31. os << indent << "if(" << component_test << ")\n";
  32. if(this->Code)
  33. {
  34. os << indent.Next() << this->Script << "\n";
  35. }
  36. else
  37. {
  38. os << indent.Next() << "include(\"" << this->Script << "\")\n";
  39. }
  40. os << indent << "endif()\n\n";
  41. }