cmCoreTryCompile.h 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. /*============================================================================
  2. CMake - Cross Platform Makefile Generator
  3. Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
  4. Distributed under the OSI-approved BSD License (the "License");
  5. see accompanying file Copyright.txt for details.
  6. This software is distributed WITHOUT ANY WARRANTY; without even the
  7. implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  8. See the License for more information.
  9. ============================================================================*/
  10. #ifndef cmCoreTryCompile_h
  11. #define cmCoreTryCompile_h
  12. #include "cmCommand.h"
  13. /** \class cmCoreTryCompile
  14. * \brief Base class for cmTryCompileCommand and cmTryRunCommand
  15. *
  16. * cmCoreTryCompile implements the functionality to build a program.
  17. * It is the base class for cmTryCompileCommand and cmTryRunCommand.
  18. */
  19. class cmCoreTryCompile : public cmCommand
  20. {
  21. public:
  22. protected:
  23. /**
  24. * This is the core code for try compile. It is here so that other
  25. * commands, such as TryRun can access the same logic without
  26. * duplication.
  27. */
  28. int TryCompileCode(std::vector<std::string> const& argv);
  29. /**
  30. * This deletes all the files created by TryCompileCode.
  31. * This way we do not have to rely on the timing and
  32. * dependencies of makefiles.
  33. */
  34. void CleanupFiles(const char* binDir);
  35. /**
  36. * This tries to find the (executable) file created by
  37. TryCompileCode. The result is stored in OutputFile. If nothing is found,
  38. the error message is stored in FindErrorMessage.
  39. */
  40. void FindOutputFile(const char* targetName);
  41. cmTypeMacro(cmCoreTryCompile, cmCommand);
  42. std::string BinaryDirectory;
  43. std::string OutputFile;
  44. std::string FindErrorMessage;
  45. bool SrcFileSignature;
  46. };
  47. #endif