cmInstallScriptGenerator.cxx 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  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) :
  15. cmInstallGenerator(0, std::vector<std::string>(), component, MessageDefault),
  16. Script(script), Code(code)
  17. {
  18. }
  19. //----------------------------------------------------------------------------
  20. cmInstallScriptGenerator
  21. ::~cmInstallScriptGenerator()
  22. {
  23. }
  24. //----------------------------------------------------------------------------
  25. void cmInstallScriptGenerator::GenerateScript(std::ostream& os)
  26. {
  27. Indent indent;
  28. std::string component_test =
  29. this->CreateComponentTest(this->Component.c_str());
  30. os << indent << "if(" << component_test << ")\n";
  31. if(this->Code)
  32. {
  33. os << indent.Next() << this->Script << "\n";
  34. }
  35. else
  36. {
  37. os << indent.Next() << "include(\"" << this->Script << "\")\n";
  38. }
  39. os << indent << "endif()\n\n";
  40. }