diff options
author | Alexander Neundorf <neundorf@kde.org> | 2007-06-04 21:08:46 (GMT) |
---|---|---|
committer | Alexander Neundorf <neundorf@kde.org> | 2007-06-04 21:08:46 (GMT) |
commit | 74750610cf29e5c0b92feb1f7b8c030e1f0e8448 (patch) | |
tree | bb1e7eedaf39b41cb4de3545a521eaa325d22689 /Source/cmCoreTryCompile.cxx | |
parent | e40c51dddf7428d25543c0f05d6a6cc16454c97f (diff) | |
download | CMake-74750610cf29e5c0b92feb1f7b8c030e1f0e8448.zip CMake-74750610cf29e5c0b92feb1f7b8c030e1f0e8448.tar.gz CMake-74750610cf29e5c0b92feb1f7b8c030e1f0e8448.tar.bz2 |
ENH: determine typesize by compiling a file and reading strings from the compiled output.
Tested with various gcc, XCode, MSVC7, sdcc
For OSX when doing TRY_COMPILE() CMAKE_OSX_ARCHITECTURES is used, if there are different results an error is generated. CMAKE_OSX_ARCHITECTURES can be overwritten for the TRY_COMPILES with CMAKE_TRY_COMPILE_OSX_ARCHITECTURES.
Alex
Diffstat (limited to 'Source/cmCoreTryCompile.cxx')
-rw-r--r-- | Source/cmCoreTryCompile.cxx | 27 |
1 files changed, 22 insertions, 5 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"); |