cmCoreTryCompile: Factor out config lookup for re-use

Store the lookup of CMAKE_TRY_COMPILE_CONFIGURATION in a local variable
so we can re-use it.
This commit is contained in:
Brad King 2016-04-11 10:39:04 -04:00
parent 9ac11bc25d
commit 82ef90fcfc
1 changed files with 4 additions and 2 deletions

View File

@ -294,6 +294,9 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv,
} }
} }
std::string const tcConfig =
this->Makefile->GetSafeDefinition("CMAKE_TRY_COMPILE_CONFIGURATION");
// we need to create a directory and CMakeLists file etc... // we need to create a directory and CMakeLists file etc...
// first create the directories // first create the directories
sourceDirectory = this->BinaryDirectory.c_str(); sourceDirectory = this->BinaryDirectory.c_str();
@ -406,8 +409,7 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv,
std::string fname = "/" + std::string(targetName) + "Targets.cmake"; std::string fname = "/" + std::string(targetName) + "Targets.cmake";
cmExportTryCompileFileGenerator tcfg(gg, targets, this->Makefile); cmExportTryCompileFileGenerator tcfg(gg, targets, this->Makefile);
tcfg.SetExportFile((this->BinaryDirectory + fname).c_str()); tcfg.SetExportFile((this->BinaryDirectory + fname).c_str());
tcfg.SetConfig(this->Makefile->GetSafeDefinition( tcfg.SetConfig(tcConfig);
"CMAKE_TRY_COMPILE_CONFIGURATION"));
if(!tcfg.GenerateImportFile()) if(!tcfg.GenerateImportFile())
{ {