ENH: set the CXX and CC environment vars

This commit is contained in:
Bill Hoffman 2002-12-06 11:43:23 -05:00
parent b6cb67eaa9
commit 7987ce88cb
1 changed files with 25 additions and 1 deletions

View File

@ -104,6 +104,18 @@ void cmGlobalGenerator::EnableLanguage(const char* lang,
determineCFile += "/Modules/CMakeDetermineCCompiler.cmake";
mf->ReadListFile(0,determineCFile.c_str());
this->SetLanguageEnabled("C");
// put CC in the environment in case user scripts want
// to run configure
// see man putenv for explaination of this stupid code...
if(mf->GetDefinition("CMAKE_C_COMPILER"))
{
static char envCC[5000];
std::string env = "CC=${CMAKE_C_COMPILER}";
mf->ExpandVariablesInString(env);
strncpy(envCC, env.c_str(), 4999);
envCC[4999] = 0;
putenv(envCC);
}
}
// check for a CXX compiler and configure it
@ -116,6 +128,18 @@ void cmGlobalGenerator::EnableLanguage(const char* lang,
determineCFile += "/Modules/CMakeDetermineCXXCompiler.cmake";
mf->ReadListFile(0,determineCFile.c_str());
this->SetLanguageEnabled("CXX");
// put CXX in the environment in case user scripts want
// to run configure
// see man putenv for explaination of this stupid code...
static char envCXX[5000];
if(mf->GetDefinition("CMAKE_CXX_COMPILER"))
{
std::string env = "CXX=${CMAKE_CXX_COMPILER}";
mf->ExpandVariablesInString(env);
strncpy(envCXX, env.c_str(), 4999);
envCXX[4999] = 0;
putenv(envCXX);
}
}