cmFindProgramCommand.h 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  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() const { return true; }
  42. /**
  43. * The name of the command as specified in CMakeList.txt.
  44. */
  45. virtual std::string GetName() const { return "find_program";}
  46. cmTypeMacro(cmFindProgramCommand, cmFindBase);
  47. private:
  48. std::string FindProgram();
  49. std::string FindNormalProgram();
  50. std::string FindNormalProgramDirsPerName();
  51. std::string FindNormalProgramNamesPerDir();
  52. std::string FindAppBundle();
  53. std::string GetBundleExecutable(std::string bundlePath);
  54. };
  55. #endif