minor fix in try compile code

This commit is contained in:
Ken Martin 2002-09-11 12:52:11 -04:00
parent b9db890ebc
commit 19323b6bac

View File

@ -1332,12 +1332,6 @@ void cmMakefile::ExpandSourceListArguments(
int cmMakefile::TryCompile(const char *srcdir, const char *bindir, int cmMakefile::TryCompile(const char *srcdir, const char *bindir,
const char *projectName, const char *targetName) const char *projectName, const char *targetName)
{ {
if (!m_LocalGenerator)
{
cmSystemTools::Error("Internal CMake error, Attempt to call Try Compile without the generator being set");
return 1;
}
// does the binary directory exist ? If not create it... // does the binary directory exist ? If not create it...
if (!cmSystemTools::FileIsDirectory(bindir)) if (!cmSystemTools::FileIsDirectory(bindir))
{ {
@ -1355,7 +1349,7 @@ int cmMakefile::TryCompile(const char *srcdir, const char *bindir,
std::string cmakeCommand = this->GetDefinition("CMAKE_COMMAND"); std::string cmakeCommand = this->GetDefinition("CMAKE_COMMAND");
cmake cm; cmake cm;
cmGlobalGenerator *gg = cmGlobalGenerator *gg =
cm.CreateGlobalGenerator(this->GetDefinition("CMAKE_GENERATOR")); cm.CreateGlobalGenerator(this->m_LocalGenerator->GetGlobalGenerator()->GetName());
if (!gg) if (!gg)
{ {
cmSystemTools::Error( cmSystemTools::Error(
@ -1364,6 +1358,7 @@ int cmMakefile::TryCompile(const char *srcdir, const char *bindir,
cmSystemTools::ChangeDirectory(cwd.c_str()); cmSystemTools::ChangeDirectory(cwd.c_str());
return 1; return 1;
} }
cm.SetGlobalGenerator(gg);
// do a configure // do a configure
cm.SetHomeDirectory(srcdir); cm.SetHomeDirectory(srcdir);