cmCoreTryCompile.h 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  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 cmCoreTryCompile_h
  4. #define cmCoreTryCompile_h
  5. #include <cmConfigure.h> // IWYU pragma: keep
  6. #include <string>
  7. #include <vector>
  8. #include "cmCommand.h"
  9. #include "cmStateTypes.h"
  10. /** \class cmCoreTryCompile
  11. * \brief Base class for cmTryCompileCommand and cmTryRunCommand
  12. *
  13. * cmCoreTryCompile implements the functionality to build a program.
  14. * It is the base class for cmTryCompileCommand and cmTryRunCommand.
  15. */
  16. class cmCoreTryCompile : public cmCommand
  17. {
  18. public:
  19. protected:
  20. /**
  21. * This is the core code for try compile. It is here so that other
  22. * commands, such as TryRun can access the same logic without
  23. * duplication.
  24. */
  25. int TryCompileCode(std::vector<std::string> const& argv, bool isTryRun);
  26. /**
  27. * This deletes all the files created by TryCompileCode.
  28. * This way we do not have to rely on the timing and
  29. * dependencies of makefiles.
  30. */
  31. void CleanupFiles(const char* binDir);
  32. /**
  33. * This tries to find the (executable) file created by
  34. TryCompileCode. The result is stored in OutputFile. If nothing is found,
  35. the error message is stored in FindErrorMessage.
  36. */
  37. void FindOutputFile(const std::string& targetName,
  38. cmStateEnums::TargetType targetType);
  39. std::string BinaryDirectory;
  40. std::string OutputFile;
  41. std::string FindErrorMessage;
  42. bool SrcFileSignature;
  43. };
  44. #endif