Imported Upstream version 2.8.9
[platform/upstream/cmake.git] / Source / cmTryCompileCommand.cxx
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 #include "cmTryCompileCommand.h"
13
14 // cmTryCompileCommand
15 bool cmTryCompileCommand
16 ::InitialPass(std::vector<std::string> const& argv, cmExecutionStatus &)
17 {
18   if(argv.size() < 3)
19     {
20     return false;
21     }
22
23   if(this->Makefile->GetCMakeInstance()->GetWorkingMode() ==
24                                                       cmake::FIND_PACKAGE_MODE)
25     {
26     this->Makefile->IssueMessage(cmake::FATAL_ERROR,
27          "The TRY_COMPILE() command is not supported in --find-package mode.");
28     return false;
29     }
30
31   this->TryCompileCode(argv);
32
33   // if They specified clean then we clean up what we can
34   if (this->SrcFileSignature)
35     {
36     if(!this->Makefile->GetCMakeInstance()->GetDebugTryCompile())
37       {
38       this->CleanupFiles(this->BinaryDirectory.c_str());
39       }
40     }
41   return true;
42 }