cmCoreTryCompile.h 1.4 KB

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