cmFindProgramCommand.h 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
  2. file Copyright.txt or https://cmake.org/licensing for details. */
  3. #ifndef cmFindProgramCommand_h
  4. #define cmFindProgramCommand_h
  5. #include <cmConfigure.h>
  6. #include <string>
  7. #include <vector>
  8. #include "cmFindBase.h"
  9. class cmCommand;
  10. class cmExecutionStatus;
  11. /** \class cmFindProgramCommand
  12. * \brief Define a command to search for an executable program.
  13. *
  14. * cmFindProgramCommand is used to define a CMake variable
  15. * that specifies an executable program. The command searches
  16. * in the current path (e.g., PATH environment variable) for
  17. * an executable that matches one of the supplied names.
  18. */
  19. class cmFindProgramCommand : public cmFindBase
  20. {
  21. public:
  22. cmFindProgramCommand();
  23. /**
  24. * This is a virtual constructor for the command.
  25. */
  26. cmCommand* Clone() CM_OVERRIDE { return new cmFindProgramCommand; }
  27. /**
  28. * This is called when the command is first encountered in
  29. * the CMakeLists.txt file.
  30. */
  31. bool InitialPass(std::vector<std::string> const& args,
  32. cmExecutionStatus& status) CM_OVERRIDE;
  33. /**
  34. * This determines if the command is invoked when in script mode.
  35. */
  36. bool IsScriptable() const CM_OVERRIDE { return true; }
  37. /**
  38. * The name of the command as specified in CMakeList.txt.
  39. */
  40. std::string GetName() const CM_OVERRIDE { return "find_program"; }
  41. private:
  42. std::string FindProgram();
  43. std::string FindNormalProgram();
  44. std::string FindNormalProgramDirsPerName();
  45. std::string FindNormalProgramNamesPerDir();
  46. std::string FindAppBundle();
  47. std::string GetBundleExecutable(std::string bundlePath);
  48. };
  49. #endif