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