cmFindProgramCommand.h 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  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 "cmFindBase.h"
  6. /** \class cmFindProgramCommand
  7. * \brief Define a command to search for an executable program.
  8. *
  9. * cmFindProgramCommand is used to define a CMake variable
  10. * that specifies an executable program. The command searches
  11. * in the current path (e.g., PATH environment variable) for
  12. * an executable that matches one of the supplied names.
  13. */
  14. class cmFindProgramCommand : public cmFindBase
  15. {
  16. public:
  17. cmFindProgramCommand();
  18. /**
  19. * This is a virtual constructor for the command.
  20. */
  21. cmCommand* Clone() CM_OVERRIDE { return new cmFindProgramCommand; }
  22. /**
  23. * This is called when the command is first encountered in
  24. * the CMakeLists.txt file.
  25. */
  26. bool InitialPass(std::vector<std::string> const& args,
  27. cmExecutionStatus& status) CM_OVERRIDE;
  28. /**
  29. * This determines if the command is invoked when in script mode.
  30. */
  31. bool IsScriptable() const CM_OVERRIDE { return true; }
  32. /**
  33. * The name of the command as specified in CMakeList.txt.
  34. */
  35. std::string GetName() const CM_OVERRIDE { return "find_program"; }
  36. cmTypeMacro(cmFindProgramCommand, cmFindBase);
  37. private:
  38. std::string FindProgram();
  39. std::string FindNormalProgram();
  40. std::string FindNormalProgramDirsPerName();
  41. std::string FindNormalProgramNamesPerDir();
  42. std::string FindAppBundle();
  43. std::string GetBundleExecutable(std::string bundlePath);
  44. };
  45. #endif