[cmake-commits] alex committed cmCoreTryCompile.cxx 1.2 1.3
cmLocalGenerator.cxx 1.226 1.227
cmake-commits at cmake.org
cmake-commits at cmake.org
Mon Jun 4 17:08:48 EDT 2007
Update of /cvsroot/CMake/CMake/Source
In directory public:/mounts/ram/cvs-serv18638/Source
Modified Files:
cmCoreTryCompile.cxx cmLocalGenerator.cxx
Log Message:
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
Index: cmLocalGenerator.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmLocalGenerator.cxx,v
retrieving revision 1.226
retrieving revision 1.227
diff -u -d -r1.226 -r1.227
--- cmLocalGenerator.cxx 28 May 2007 14:25:03 -0000 1.226
+++ cmLocalGenerator.cxx 4 Jun 2007 21:08:46 -0000 1.227
@@ -1927,7 +1927,8 @@
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)
Index: cmCoreTryCompile.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmCoreTryCompile.cxx,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- cmCoreTryCompile.cxx 24 May 2007 16:06:59 -0000 1.2
+++ cmCoreTryCompile.cxx 4 Jun 2007 21:08:46 -0000 1.3
@@ -225,13 +225,30 @@
}
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");
More information about the Cmake-commits
mailing list