Selaa lähdekoodia

BUG: CMAKE_TRY_COMPILE_CONFIGURATION should be obtained from the cmMakefile instance for the listfile containing the TRY_COMPILE call, not the top level listfile.

Brad King 21 vuotta sitten
vanhempi
sitoutus
9b1771aef4

+ 2 - 1
Source/cmGlobalCodeWarriorGenerator.cxx

@@ -44,7 +44,8 @@ int cmGlobalCodeWarriorGenerator::TryCompile(const char *,
                                              const char* /*bindir*/, 
                                              const char* /*projectName*/,
                                              const char* /*targetName*/,
-                                             std::string* /*output*/)
+                                             std::string* /*output*/,
+                                             cmMakefile* /*mf*/)
 {
   return 1;
 }

+ 1 - 1
Source/cmGlobalCodeWarriorGenerator.h

@@ -54,7 +54,7 @@ public:
    */
   virtual int TryCompile(const char *srcdir, const char *bindir,
                          const char *projectName, const char *targetName,
-                         std::string *output);
+                         std::string *output, cmMakefile* mf);
 
   /**
    * Generate the all required files for building this project/tree. This

+ 1 - 1
Source/cmGlobalGenerator.cxx

@@ -448,7 +448,7 @@ void cmGlobalGenerator::LocalGenerate()
 
 int cmGlobalGenerator::TryCompile(const char *, const char *bindir, 
                                   const char *, const char *target,
-                                  std::string *output)
+                                  std::string *output, cmMakefile*)
 {
   // now build the test
   std::string makeCommand = 

+ 1 - 1
Source/cmGlobalGenerator.h

@@ -90,7 +90,7 @@ public:
    */
   virtual int TryCompile(const char *srcdir, const char *bindir,
                          const char *projectName, const char *targetName,
-                         std::string *output);
+                         std::string *output, cmMakefile* mf);
 
   ///! Set the CMake instance
   void SetCMakeInstance(cmake *cm) {

+ 4 - 4
Source/cmGlobalVisualStudio6Generator.cxx

@@ -68,7 +68,8 @@ int cmGlobalVisualStudio6Generator::TryCompile(const char *,
                                                const char *bindir, 
                                                const char *projectName,
                                                const char *targetName,
-                                               std::string *output)
+                                               std::string *output,
+                                               cmMakefile* mf)
 {
   // now build the test
   std::string makeCommand = 
@@ -115,10 +116,9 @@ int cmGlobalVisualStudio6Generator::TryCompile(const char *,
     makeCommand += "ALL_BUILD";
     }
   makeCommand += " - ";
-  if ( m_LocalGenerators[0]->GetMakefile()->GetDefinition("CMAKE_TRY_COMPILE_CONFIGURATION") )
+  if(const char* config = mf->GetDefinition("CMAKE_TRY_COMPILE_CONFIGURATION"))
     {
-    makeCommand += 
-      m_LocalGenerators[0]->GetMakefile()->GetDefinition("CMAKE_TRY_COMPILE_CONFIGURATION");
+    makeCommand += config;
     }
   else
     {

+ 1 - 1
Source/cmGlobalVisualStudio6Generator.h

@@ -55,7 +55,7 @@ public:
    */
   virtual int TryCompile(const char *srcdir, const char *bindir,
                          const char *projectName, const char *targetName,
-                         std::string *output);
+                         std::string *output, cmMakefile* mf);
 
   /**
    * Generate the all required files for building this project/tree. This

+ 4 - 4
Source/cmGlobalVisualStudio7Generator.cxx

@@ -44,7 +44,8 @@ int cmGlobalVisualStudio7Generator::TryCompile(const char *,
                                                const char *bindir, 
                                                const char *projectName,
                                                const char *targetName,
-                                               std::string *output)
+                                               std::string *output,
+                                               cmMakefile* mf)
 {
   // now build the test
   std::string makeCommand = 
@@ -77,10 +78,9 @@ int cmGlobalVisualStudio7Generator::TryCompile(const char *,
   makeCommand += " ";
   makeCommand += projectName;
   makeCommand += ".sln /build ";
-  if ( m_LocalGenerators[0]->GetMakefile()->GetDefinition("CMAKE_TRY_COMPILE_CONFIGURATION") )
+  if(const char* config = mf->GetDefinition("CMAKE_TRY_COMPILE_CONFIGURATION"))
     {
-    makeCommand += 
-      m_LocalGenerators[0]->GetMakefile()->GetDefinition("CMAKE_TRY_COMPILE_CONFIGURATION");
+    makeCommand += config;
     }
   else
     {

+ 1 - 1
Source/cmGlobalVisualStudio7Generator.h

@@ -55,7 +55,7 @@ public:
    */
   virtual int TryCompile(const char *srcdir, const char *bindir,
                          const char *projectName, const char *targetName,
-                         std::string *output);
+                         std::string *output, cmMakefile* mf);
 
   /**
    * Generate the all required files for building this project/tree. This

+ 2 - 1
Source/cmMakefile.cxx

@@ -2093,7 +2093,8 @@ int cmMakefile::TryCompile(const char *srcdir, const char *bindir,
     m_LocalGenerator->GetGlobalGenerator()->TryCompile(srcdir,bindir,
                                                        projectName, 
                                                        targetName,
-                                                       output);
+                                                       output,
+                                                       this);
 
   cmSystemTools::ChangeDirectory(cwd.c_str());
   return ret;