cmConfigureFileCommand.h 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. /*=========================================================================
  2. Program: CMake - Cross-Platform Makefile Generator
  3. Module: $RCSfile$
  4. Language: C++
  5. Date: $Date$
  6. Version: $Revision$
  7. Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved.
  8. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details.
  9. This software is distributed WITHOUT ANY WARRANTY; without even
  10. the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
  11. PURPOSE. See the above copyright notices for more information.
  12. =========================================================================*/
  13. #ifndef cmConfigureFileCommand_h
  14. #define cmConfigureFileCommand_h
  15. #include "cmStandardIncludes.h"
  16. #include "cmCommand.h"
  17. class cmConfigureFileCommand : public cmCommand
  18. {
  19. public:
  20. virtual cmCommand* Clone()
  21. {
  22. return new cmConfigureFileCommand;
  23. }
  24. /**
  25. * This is called when the command is first encountered in
  26. * the input file.
  27. */
  28. virtual bool InitialPass(std::vector<std::string> const& args);
  29. /**
  30. * The name of the command as specified in CMakeList.txt.
  31. */
  32. virtual const char* GetName() { return "CONFIGURE_FILE";}
  33. /**
  34. * Succinct documentation.
  35. */
  36. virtual const char* GetTerseDocumentation()
  37. {
  38. return "Copy a file to another location and modify its contents.";
  39. }
  40. /**
  41. * Longer documentation.
  42. */
  43. virtual const char* GetFullDocumentation()
  44. {
  45. return
  46. " CONFIGURE_FILE(InputFile OutputFile\n"
  47. " [COPYONLY] [ESCAPE_QUOTES]\n"
  48. " [IMMEDIATE] [@ONLY])\n"
  49. "The Input and Ouput files have to have full paths. "
  50. "This command replaces any variables in the input file referenced as "
  51. "${VAR} or @VAR@ with their values as determined by CMake. If a "
  52. "variable is not defined, it will be replaced with nothing. "
  53. "If COPYONLY is specified, then then no variable expansion will take "
  54. "place. If ESCAPE_QUOTES is specified in then any substitued quotes "
  55. "will be C-style escaped. "
  56. "If IMMEDIATE is specified, then the file will be configured with "
  57. "the current values of CMake variables instead of waiting until the "
  58. "end of CMakeLists processing. If @ONLY is specified, only variables "
  59. "of the form @VAR@ will be replaces and ${VAR} will be ignored. "
  60. "This is useful for configuring tcl scripts that use ${VAR}.";
  61. }
  62. virtual void FinalPass();
  63. private:
  64. void ConfigureFile();
  65. std::string m_InputFile;
  66. std::string m_OuputFile;
  67. bool m_CopyOnly;
  68. bool m_EscapeQuotes;
  69. bool m_Immediate;
  70. bool m_AtOnly;
  71. };
  72. #endif