From 9c2dcf48362a82819bb1ca2ae6b139c938103d5b Mon Sep 17 00:00:00 2001 From: Bill Hoffman Date: Tue, 19 May 2009 11:25:28 -0400 Subject: [PATCH] BUG: fix for #0009051 CMake does not pass CMAKE_OSX_SYSROOT and CMAKE_OSX_DEPLOYMENT_TARGET when running TRY_COMPILE --- Source/cmCoreTryCompile.cxx | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/Source/cmCoreTryCompile.cxx b/Source/cmCoreTryCompile.cxx index 0ebe2cde0..c45a8063b 100644 --- a/Source/cmCoreTryCompile.cxx +++ b/Source/cmCoreTryCompile.cxx @@ -250,6 +250,20 @@ int cmCoreTryCompile::TryCompileCode(std::vector const& argv) flag += this->Makefile->GetSafeDefinition("CMAKE_OSX_ARCHITECTURES"); 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,