cmTryRunCommand.h 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  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 cmTryRunCommand_h
  4. #define cmTryRunCommand_h
  5. #include "cmConfigure.h" // IWYU pragma: keep
  6. #include <string>
  7. #include <vector>
  8. #include "cmCoreTryCompile.h"
  9. class cmCommand;
  10. class cmExecutionStatus;
  11. /** \class cmTryRunCommand
  12. * \brief Specifies where to install some files
  13. *
  14. * cmTryRunCommand is used to test if soucre code can be compiled
  15. */
  16. class cmTryRunCommand : public cmCoreTryCompile
  17. {
  18. public:
  19. /**
  20. * This is a virtual constructor for the command.
  21. */
  22. cmCommand* Clone() override { return new cmTryRunCommand; }
  23. /**
  24. * This is called when the command is first encountered in
  25. * the CMakeLists.txt file.
  26. */
  27. bool InitialPass(std::vector<std::string> const& args,
  28. cmExecutionStatus& status) override;
  29. private:
  30. void RunExecutable(const std::string& runArgs,
  31. std::string* runOutputContents);
  32. void DoNotRunExecutable(const std::string& runArgs,
  33. const std::string& srcFile,
  34. std::string* runOutputContents);
  35. std::string CompileResultVariable;
  36. std::string RunResultVariable;
  37. std::string OutputVariable;
  38. std::string RunOutputVariable;
  39. std::string CompileOutputVariable;
  40. };
  41. #endif