[cmake-commits] alex committed cmTryRunCommand.cxx 1.32 1.33

cmake-commits at cmake.org cmake-commits at cmake.org
Mon Jul 23 10:47:25 EDT 2007


Update of /cvsroot/CMake/CMake/Source
In directory public:/mounts/ram/cvs-serv11071

Modified Files:
	cmTryRunCommand.cxx 
Log Message:

ENH: try to create a file which can be used for presetting the cache values
of the TRY_RUN() results when crosscompiling

Alex


Index: cmTryRunCommand.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmTryRunCommand.cxx,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -d -r1.32 -r1.33
--- cmTryRunCommand.cxx	1 Jun 2007 15:16:29 -0000	1.32
+++ cmTryRunCommand.cxx	23 Jul 2007 14:47:23 -0000	1.33
@@ -272,6 +272,7 @@
     error = true;
     }
 
+  // is the output from the executable used ?
   if (out!=0)
     {
     if (this->Makefile->GetDefinition(internalRunOutputName.c_str()) == 0)
@@ -312,6 +313,25 @@
 
   if (error)
     {
+    static bool firstRun = true;
+    std::string fileName =  this->Makefile->GetHomeOutputDirectory();
+    fileName += "/TryRunResults.cmake";
+    std::ofstream file(fileName.c_str(), firstRun?std::ios::out : std::ios::app);
+    if ( file )
+      {
+      file << "SET( " << internalRunOutputName << " \""
+           << this->Makefile->GetDefinition(this->RunResultVariable.c_str())
+           << "\" CACHE STRING \"Result from TRY_RUN\" )\n\n";
+      if (out!=0)
+        {
+        file << "SET( " << this->RunResultVariable << " \""
+            << this->Makefile->GetDefinition(internalRunOutputName.c_str())
+            << "\" CACHE STRING \"Output from TRY_RUN\" )\n\n";
+        }
+      file.close();
+      }
+    firstRun = false;
+
     std::string errorMessage = "TRY_RUN() invoked in cross-compiling mode, "
                                "please set the following cache variables "
                                "appropriatly:\n";



More information about the Cmake-commits mailing list