Preserve ENV{MAKEFLAGS} in CMake script mode

Commit 02f7cfbc (Need to remove the MAKEFLAGS when cmake starts,
2003-05-13) removed the MAKEFLAGS environment variable when CMake starts
to prevent try_compile() from inheriting "make -i".  This is unnecessary
in script mode (cmake -P).  Instead remove the variable only when
configuring a project.
This commit is contained in:
Brad King 2010-06-21 10:50:11 -04:00
parent e45a600a0f
commit 0a7c551bf6
1 changed files with 10 additions and 10 deletions

View File

@ -162,16 +162,6 @@ cmake::cmake()
}
#endif
// If MAKEFLAGS are given in the environment, remove the environment
// variable. This will prevent try-compile from succeeding when it
// should fail (if "-i" is an option). We cannot simply test
// whether "-i" is given and remove it because some make programs
// encode the MAKEFLAGS variable in a strange way.
if(getenv("MAKEFLAGS"))
{
cmSystemTools::PutEnv("MAKEFLAGS=");
}
this->Verbose = false;
this->InTryCompile = false;
this->CacheManager = new cmCacheManager(this);
@ -2231,6 +2221,16 @@ int cmake::Run(const std::vector<std::string>& args, bool noconfigure)
}
}
// If MAKEFLAGS are given in the environment, remove the environment
// variable. This will prevent try-compile from succeeding when it
// should fail (if "-i" is an option). We cannot simply test
// whether "-i" is given and remove it because some make programs
// encode the MAKEFLAGS variable in a strange way.
if(getenv("MAKEFLAGS"))
{
cmSystemTools::PutEnv("MAKEFLAGS=");
}
this->PreLoadCMakeFiles();
std::string systemFile = this->GetHomeOutputDirectory();