Imported Upstream version 2.8.9
[platform/upstream/cmake.git] / Source / cmUtilitySourceCommand.h
1 /*============================================================================
2   CMake - Cross Platform Makefile Generator
3   Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
4
5   Distributed under the OSI-approved BSD License (the "License");
6   see accompanying file Copyright.txt for details.
7
8   This software is distributed WITHOUT ANY WARRANTY; without even the
9   implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10   See the License for more information.
11 ============================================================================*/
12 #ifndef cmUtilitySourceCommand_h
13 #define cmUtilitySourceCommand_h
14
15 #include "cmCommand.h"
16
17 /** \class cmUtilitySourceCommand
18  * \brief A command to setup a cache entry with the location of a third-party
19  * utility's source.
20  *
21  * cmUtilitySourceCommand is used when a third-party utility's source is
22  * included in the project's source tree.  It specifies the location of
23  * the executable's source, and any files that may be needed to confirm the
24  * identity of the source.
25  */
26 class cmUtilitySourceCommand : public cmCommand
27 {
28 public:
29   /**
30    * This is a virtual constructor for the command.
31    */
32   virtual cmCommand* Clone() 
33     {
34     return new cmUtilitySourceCommand;
35     }
36
37   /**
38    * This is called when the command is first encountered in
39    * the CMakeLists.txt file.
40    */
41   virtual bool InitialPass(std::vector<std::string> const& args,
42                            cmExecutionStatus &status);
43
44   /**
45    * The name of the command as specified in CMakeList.txt.
46    */
47   virtual const char* GetName() const { return "utility_source";}
48
49   /**
50    * Succinct documentation.
51    */
52   virtual const char* GetTerseDocumentation() const
53     {
54     return "Specify the source tree of a third-party utility.";
55     }
56   
57   /**
58    * More documentation.
59    */
60   virtual const char* GetFullDocumentation() const
61     {
62     return
63       "  utility_source(cache_entry executable_name\n"
64       "                 path_to_source [file1 file2 ...])\n"
65       "When a third-party utility's source is included in the distribution, "
66       "this command specifies its location and name.  The cache entry will "
67       "not be set unless the path_to_source and all listed files exist.  It "
68       "is assumed that the source tree of the utility will have been built "
69       "before it is needed.\n"
70       "When cross compiling CMake will print a warning if a utility_source() "
71       "command is executed, because in many cases it is used to build an "
72       "executable which is executed later on. This doesn't work when "
73       "cross compiling, since the executable can run only on their target "
74       "platform. So in this case the cache entry has to be adjusted manually "
75       "so it points to an executable which is runnable on the build host.";
76     }
77
78   /** This command is kept for compatibility with older CMake versions. */
79   virtual bool IsDiscouraged() const
80     {
81     return true;
82     }
83
84
85   cmTypeMacro(cmUtilitySourceCommand, cmCommand);
86 };
87
88
89
90 #endif