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.

This commit is contained in:
Brad King 2004-08-04 16:33:10 -04:00
parent f99d948916
commit 9b1771aef4
9 changed files with 17 additions and 15 deletions

View File

@ -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;
}

View File

@ -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

View File

@ -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 =

View File

@ -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) {

View File

@ -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
{

View File

@ -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

View File

@ -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
{

View File

@ -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

View File

@ -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;