cmFindProgramCommand.h 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  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. /**
  25. * This is a virtual constructor for the command.
  26. */
  27. virtual cmCommand* Clone()
  28. {
  29. return new cmFindProgramCommand;
  30. }
  31. /**
  32. * This is called when the command is first encountered in
  33. * the CMakeLists.txt file.
  34. */
  35. virtual bool InitialPass(std::vector<std::string> const& args,
  36. cmExecutionStatus &status);
  37. /**
  38. * This determines if the command is invoked when in script mode.
  39. */
  40. virtual bool IsScriptable() const { return true; }
  41. /**
  42. * The name of the command as specified in CMakeList.txt.
  43. */
  44. virtual const char* GetName() const { return "find_program";}
  45. cmTypeMacro(cmFindProgramCommand, cmFindBase);
  46. protected:
  47. std::string FindProgram(std::vector<std::string> names);
  48. private:
  49. std::string FindAppBundle(std::vector<std::string> names);
  50. std::string GetBundleExecutable(std::string bundlePath);
  51. };
  52. #endif