cmCoreTryCompile.h 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  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(std::string const& 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. private:
  44. std::vector<std::string> WarnCMP0067;
  45. std::string LookupStdVar(std::string const& var, bool warnCMP0067);
  46. };
  47. #endif