cmFindProgramCommand.h 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  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 cmFindProgramCommand_h
  11. #define cmFindProgramCommand_h
  12. #include "cmFindBase.h"
  13. /** \class cmFindProgramCommand
  14. * \brief Define a command to search for an executable program.
  15. *
  16. * cmFindProgramCommand is used to define a CMake variable
  17. * that specifies an executable program. The command searches
  18. * in the current path (e.g., PATH environment variable) for
  19. * an executable that matches one of the supplied names.
  20. */
  21. class cmFindProgramCommand : public cmFindBase
  22. {
  23. public:
  24. cmFindProgramCommand();
  25. /**
  26. * This is a virtual constructor for the command.
  27. */
  28. virtual cmCommand* Clone()
  29. {
  30. return new cmFindProgramCommand;
  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. * This determines if the command is invoked when in script mode.
  40. */
  41. virtual bool IsScriptable() { return true; }
  42. /**
  43. * The name of the command as specified in CMakeList.txt.
  44. */
  45. virtual const char* GetName() { return "find_program";}
  46. /**
  47. * Succinct documentation.
  48. */
  49. virtual const char* GetTerseDocumentation()
  50. {
  51. return "Find an executable program.";
  52. }
  53. cmTypeMacro(cmFindProgramCommand, cmFindBase);
  54. protected:
  55. std::string FindProgram(std::vector<std::string> names);
  56. private:
  57. std::string FindAppBundle(std::vector<std::string> names);
  58. std::string GetBundleExecutable(std::string bundlePath);
  59. };
  60. #endif