BUG: fix for #0009051 CMake does not pass CMAKE_OSX_SYSROOT and CMAKE_OSX_DEPLOYMENT_TARGET when running TRY_COMPILE

This commit is contained in:
Bill Hoffman 2009-05-19 11:25:28 -04:00
parent 831ca4f57c
commit 9c2dcf4836
1 changed files with 14 additions and 0 deletions

View File

@ -250,6 +250,20 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv)
flag += this->Makefile->GetSafeDefinition("CMAKE_OSX_ARCHITECTURES"); flag += this->Makefile->GetSafeDefinition("CMAKE_OSX_ARCHITECTURES");
cmakeFlags.push_back(flag); cmakeFlags.push_back(flag);
} }
/* on APPLE also pass CMAKE_OSX_SYSROOT to the try_compile */
if(this->Makefile->GetDefinition("CMAKE_OSX_SYSROOT")!=0)
{
std::string flag="-DCMAKE_OSX_SYSROOT=";
flag += this->Makefile->GetSafeDefinition("CMAKE_OSX_SYSROOT");
cmakeFlags.push_back(flag);
}
/* on APPLE also pass CMAKE_OSX_DEPLOYMENT_TARGET to the try_compile */
if(this->Makefile->GetDefinition("CMAKE_OSX_DEPLOYMENT_TARGET")!=0)
{
std::string flag="-DCMAKE_OSX_DEPLOYMENT_TARGET=";
flag += this->Makefile->GetSafeDefinition("CMAKE_OSX_DEPLOYMENT_TARGET");
cmakeFlags.push_back(flag);
}
fprintf(fout, "ADD_EXECUTABLE(cmTryCompileExec \"%s\")\n",source.c_str()); fprintf(fout, "ADD_EXECUTABLE(cmTryCompileExec \"%s\")\n",source.c_str());
fprintf(fout, fprintf(fout,