diff options
Diffstat (limited to 'Source')
-rw-r--r-- | Source/cmCoreTryCompile.cxx | 27 | ||||
-rw-r--r-- | Source/cmLocalGenerator.cxx | 3 |
2 files changed, 24 insertions, 6 deletions
diff --git a/Source/cmCoreTryCompile.cxx b/Source/cmCoreTryCompile.cxx index ee4fe97..8abd690 100644 --- a/Source/cmCoreTryCompile.cxx +++ b/Source/cmCoreTryCompile.cxx @@ -225,13 +225,30 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv) } fprintf(fout, ")\n"); } - const char* platformOptions = - this->Makefile->GetDefinition("CMAKE_TRY_COMPILE_PLATFORM_OPTIONS"); - if ( platformOptions ) + + /* for the TRY_COMPILEs we want to be able to specify the architecture. + So the user can set CMAKE_OSX_ARCHITECTURE to i386;ppc and then set + CMAKE_TRY_COMPILE_OSX_ARCHITECTURE first to i386 and then to ppc to + have the tests run for each specific architecture. Since + cmLocalGenerator doesn't allow building for "the other" + architecture only via CMAKE_OSX_ARCHITECTURES,use to CMAKE_DO_TRY_COMPILE + to enforce it for this case here. + */ + cmakeFlags.push_back("-DCMAKE_DO_TRY_COMPILE=TRUE"); + if(this->Makefile->GetDefinition("CMAKE_TRY_COMPILE_OSX_ARCHITECTURES")!=0) { - fprintf(fout, "%s\n", platformOptions); + std::string flag="-DCMAKE_OSX_ARCHITECTURES="; + flag += this->Makefile->GetSafeDefinition( + "CMAKE_TRY_COMPILE_OSX_ARCHITECTURES"); + cmakeFlags.push_back(flag); } - + else if (this->Makefile->GetDefinition("CMAKE_OSX_ARCHITECTURES")!=0) + { + std::string flag="-DCMAKE_OSX_ARCHITECTURES="; + flag += this->Makefile->GetSafeDefinition("CMAKE_OSX_ARCHITECTURES"); + cmakeFlags.push_back(flag); + } + fprintf(fout, "ADD_EXECUTABLE(cmTryCompileExec \"%s\")\n",source.c_str()); fprintf(fout, "TARGET_LINK_LIBRARIES(cmTryCompileExec ${LINK_LIBRARIES})\n"); diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index f831282..8f2bcca 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -1927,7 +1927,8 @@ void cmLocalGenerator::AddLanguageFlags(std::string& flags, std::vector<std::string> archs; cmSystemTools::ExpandListArgument(std::string(osxArch), archs); - if(archs.size() > 1) + if((archs.size() > 1) + || ((archs.size()== 1) && this->Makefile->IsOn("CMAKE_DO_TRY_COMPILE"))) { for( std::vector<std::string>::iterator i = archs.begin(); i != archs.end(); ++i) |