cmFindProgramCommand.h 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  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" // IWYU pragma: keep
  6. #include <string>
  7. #include <vector>
  8. #include "cm_memory.hxx"
  9. #include "cmCommand.h"
  10. #include "cmFindBase.h"
  11. class cmExecutionStatus;
  12. /** \class cmFindProgramCommand
  13. * \brief Define a command to search for an executable program.
  14. *
  15. * cmFindProgramCommand is used to define a CMake variable
  16. * that specifies an executable program. The command searches
  17. * in the current path (e.g., PATH environment variable) for
  18. * an executable that matches one of the supplied names.
  19. */
  20. class cmFindProgramCommand : public cmFindBase
  21. {
  22. public:
  23. cmFindProgramCommand();
  24. /**
  25. * This is a virtual constructor for the command.
  26. */
  27. std::unique_ptr<cmCommand> Clone() override
  28. {
  29. return cm::make_unique<cmFindProgramCommand>();
  30. }
  31. /**
  32. * This is called when the command is first encountered in
  33. * the CMakeLists.txt file.
  34. */
  35. bool InitialPass(std::vector<std::string> const& args,
  36. cmExecutionStatus& status) override;
  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 const& bundlePath);
  44. };
  45. #endif