From 9b1771aef4c38d2b536d1b2306b62c1b2c27266e Mon Sep 17 00:00:00 2001 From: Brad King Date: Wed, 4 Aug 2004 16:33:10 -0400 Subject: [PATCH] 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. --- Source/cmGlobalCodeWarriorGenerator.cxx | 3 ++- Source/cmGlobalCodeWarriorGenerator.h | 2 +- Source/cmGlobalGenerator.cxx | 2 +- Source/cmGlobalGenerator.h | 2 +- Source/cmGlobalVisualStudio6Generator.cxx | 8 ++++---- Source/cmGlobalVisualStudio6Generator.h | 2 +- Source/cmGlobalVisualStudio7Generator.cxx | 8 ++++---- Source/cmGlobalVisualStudio7Generator.h | 2 +- Source/cmMakefile.cxx | 3 ++- 9 files changed, 17 insertions(+), 15 deletions(-) diff --git a/Source/cmGlobalCodeWarriorGenerator.cxx b/Source/cmGlobalCodeWarriorGenerator.cxx index d30b23803..0a9c1b59b 100644 --- a/Source/cmGlobalCodeWarriorGenerator.cxx +++ b/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; } diff --git a/Source/cmGlobalCodeWarriorGenerator.h b/Source/cmGlobalCodeWarriorGenerator.h index d4859adcb..3c6dee24f 100644 --- a/Source/cmGlobalCodeWarriorGenerator.h +++ b/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 diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index 907e11103..2ab00a6f4 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/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 = diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h index a22bc4c44..b96331676 100644 --- a/Source/cmGlobalGenerator.h +++ b/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) { diff --git a/Source/cmGlobalVisualStudio6Generator.cxx b/Source/cmGlobalVisualStudio6Generator.cxx index f4ae839bc..5dfda72c4 100644 --- a/Source/cmGlobalVisualStudio6Generator.cxx +++ b/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 { diff --git a/Source/cmGlobalVisualStudio6Generator.h b/Source/cmGlobalVisualStudio6Generator.h index 4aaa619e8..97338a148 100644 --- a/Source/cmGlobalVisualStudio6Generator.h +++ b/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 diff --git a/Source/cmGlobalVisualStudio7Generator.cxx b/Source/cmGlobalVisualStudio7Generator.cxx index d7301a0a1..b8fa1afe8 100644 --- a/Source/cmGlobalVisualStudio7Generator.cxx +++ b/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 { diff --git a/Source/cmGlobalVisualStudio7Generator.h b/Source/cmGlobalVisualStudio7Generator.h index 50e69848b..2c4db0e42 100644 --- a/Source/cmGlobalVisualStudio7Generator.h +++ b/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 diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index c55267144..1f6b8f25e 100644 --- a/Source/cmMakefile.cxx +++ b/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;