Просмотр исходного кода

added a flag if a cmake is in try compile

Ken Martin 23 лет назад
Родитель
Сommit
2aea6d528e
3 измененных файлов с 9 добавлено и 0 удалено
  1. 1 0
      Source/cmMakefile.cxx
  2. 1 0
      Source/cmake.cxx
  3. 7 0
      Source/cmake.h

+ 1 - 0
Source/cmMakefile.cxx

@@ -1352,6 +1352,7 @@ int cmMakefile::TryCompile(const char *srcdir, const char *bindir,
   // be run that way but the cmake object requires a vailid path
   std::string cmakeCommand = this->GetDefinition("CMAKE_COMMAND");
   cmake cm;
+  cm.SetIsInTryCompile(true);
   cmGlobalGenerator *gg = 
     cm.CreateGlobalGenerator(this->m_LocalGenerator->GetGlobalGenerator()->GetName());
   if (!gg)

+ 1 - 0
Source/cmake.cxx

@@ -37,6 +37,7 @@
 cmake::cmake()
 {
   m_Verbose = false;
+  m_InTryCompile = false;
   m_CacheManager = new cmCacheManager;
   m_GlobalGenerator = 0;
   this->AddDefaultCommands();

+ 7 - 0
Source/cmake.h

@@ -175,6 +175,12 @@ class cmake
   ///! Parse command line arguments
   void SetArgs(const std::vector<std::string>&);
 
+  ///! Is this cmake running as a result of a TRY_COMPILE command
+  bool GetIsInTryCompile() { return m_InTryCompile; }
+  
+  ///! Is this cmake running as a result of a TRY_COMPILE command
+  void SetIsInTryCompile(bool i) { m_InTryCompile = i; }
+  
 protected:
   typedef std::map<cmStdString, cmCommand*> RegisteredCommandsMap;
   RegisteredCommandsMap m_Commands;
@@ -204,5 +210,6 @@ protected:
 private:
   bool m_Verbose;
   bool m_Local;
+  bool m_InTryCompile;
 };