Imported Upstream version 2.8.12.2
[platform/upstream/cmake.git] / Source / cmFindProgramCommand.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 cmFindProgramCommand_h
13 #define cmFindProgramCommand_h
14
15 #include "cmFindBase.h"
16
17 /** \class cmFindProgramCommand
18  * \brief Define a command to search for an executable program.
19  *
20  * cmFindProgramCommand is used to define a CMake variable
21  * that specifies an executable program. The command searches
22  * in the current path (e.g., PATH environment variable) for
23  * an executable that matches one of the supplied names.
24  */
25 class cmFindProgramCommand : public cmFindBase
26 {
27 public:
28   /**
29    * This is a virtual constructor for the command.
30    */
31   virtual cmCommand* Clone()
32     {
33     return new cmFindProgramCommand;
34     }
35
36   /**
37    * This is called when the command is first encountered in
38    * the CMakeLists.txt file.
39    */
40   virtual bool InitialPass(std::vector<std::string> const& args,
41                            cmExecutionStatus &status);
42
43   /**
44    * This determines if the command is invoked when in script mode.
45    */
46   virtual bool IsScriptable() const { return true; }
47
48   /**
49    * The name of the command as specified in CMakeList.txt.
50    */
51   virtual const char* GetName() const { return "find_program";}
52
53   /**
54    * Succinct documentation.
55    */
56   virtual const char* GetTerseDocumentation() const
57     {
58     return "Find an executable program.";
59     }
60
61   cmTypeMacro(cmFindProgramCommand, cmFindBase);
62
63 protected:
64   std::string FindProgram(std::vector<std::string> names);
65   virtual void GenerateDocumentation();
66
67 private:
68   std::string FindAppBundle(std::vector<std::string> names);
69   std::string GetBundleExecutable(std::string bundlePath);
70
71 };
72
73
74
75 #endif