cmUtilitySourceCommand.h 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  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. #ifndef cmUtilitySourceCommand_h
  11. #define cmUtilitySourceCommand_h
  12. #include "cmCommand.h"
  13. /** \class cmUtilitySourceCommand
  14. * \brief A command to setup a cache entry with the location of a third-party
  15. * utility's source.
  16. *
  17. * cmUtilitySourceCommand is used when a third-party utility's source is
  18. * included in the project's source tree. It specifies the location of
  19. * the executable's source, and any files that may be needed to confirm the
  20. * identity of the source.
  21. */
  22. class cmUtilitySourceCommand : public cmCommand
  23. {
  24. public:
  25. /**
  26. * This is a virtual constructor for the command.
  27. */
  28. virtual cmCommand* Clone()
  29. {
  30. return new cmUtilitySourceCommand;
  31. }
  32. /**
  33. * This is called when the command is first encountered in
  34. * the CMakeLists.txt file.
  35. */
  36. virtual bool InitialPass(std::vector<std::string> const& args,
  37. cmExecutionStatus &status);
  38. /**
  39. * The name of the command as specified in CMakeList.txt.
  40. */
  41. virtual const char* GetName() { return "utility_source";}
  42. /**
  43. * Succinct documentation.
  44. */
  45. virtual const char* GetTerseDocumentation()
  46. {
  47. return "Specify the source tree of a third-party utility.";
  48. }
  49. /**
  50. * More documentation.
  51. */
  52. virtual const char* GetFullDocumentation()
  53. {
  54. return
  55. " utility_source(cache_entry executable_name\n"
  56. " path_to_source [file1 file2 ...])\n"
  57. "When a third-party utility's source is included in the distribution, "
  58. "this command specifies its location and name. The cache entry will "
  59. "not be set unless the path_to_source and all listed files exist. It "
  60. "is assumed that the source tree of the utility will have been built "
  61. "before it is needed.\n"
  62. "When cross compiling CMake will print a warning if a utility_source() "
  63. "command is executed, because in many cases it is used to build an "
  64. "executable which is executed later on. This doesn't work when "
  65. "cross compiling, since the executable can run only on their target "
  66. "platform. So in this case the cache entry has to be adjusted manually "
  67. "so it points to an executable which is runnable on the build host.";
  68. }
  69. /** This command is kept for compatibility with older CMake versions. */
  70. virtual bool IsDiscouraged()
  71. {
  72. return true;
  73. }
  74. cmTypeMacro(cmUtilitySourceCommand, cmCommand);
  75. };
  76. #endif