[cmake-commits] martink committed CMakeLists.txt 1.346 1.347 cmake.cxx 1.283 1.284

cmake-commits at cmake.org cmake-commits at cmake.org
Wed Feb 28 12:25:21 EST 2007


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

Modified Files:
	CMakeLists.txt cmake.cxx 
Log Message:
BUG: allow system information to accept the -G option


Index: CMakeLists.txt
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/CMakeLists.txt,v
retrieving revision 1.346
retrieving revision 1.347
diff -u -d -r1.346 -r1.347
--- CMakeLists.txt	27 Feb 2007 18:04:29 -0000	1.346
+++ CMakeLists.txt	28 Feb 2007 17:25:19 -0000	1.347
@@ -353,47 +353,7 @@
 ENDIF(BUILD_WXDialog)
 
 # Testing
-IF (NOT DART_ROOT)
-  SET(MAKEPROGRAM ${CMAKE_MAKE_PROGRAM})
-ENDIF (NOT DART_ROOT)
-
 IF(BUILD_TESTING)
-  SET(CMAKE_TEST_GENERATOR "" CACHE STRING "Generator used when running tests")
-  SET(CMAKE_TEST_MAKEPROGRAM "" CACHE FILEPATH "Generator used when running tests")
-  IF(NOT CMAKE_TEST_GENERATOR)
-    SET(CMAKE_TEST_GENERATOR "${CMAKE_GENERATOR}")
-    SET(CMAKE_TEST_MAKEPROGRAM "${MAKEPROGRAM}")
-  ELSE(NOT CMAKE_TEST_GENERATOR)
-    SET(CMAKE_TEST_DIFFERENT_GENERATOR TRUE)
-  ENDIF(NOT CMAKE_TEST_GENERATOR)
-
-  # Are we testing with the MSVC compiler?
-  SET(CMAKE_TEST_MSVC 0)
-  IF(MSVC AND NOT CMAKE_TEST_DIFFERENT_GENERATOR)
-    SET(CMAKE_TEST_MSVC 1)
-  ELSE(MSVC AND NOT CMAKE_TEST_DIFFERENT_GENERATOR)
-    IF("${CMAKE_TEST_GENERATOR}" MATCHES "NMake" OR
-        "${CMAKE_TEST_GENERATOR}" MATCHES "Visual Studio")
-      SET(CMAKE_TEST_MSVC 1)
-    ENDIF("${CMAKE_TEST_GENERATOR}" MATCHES "NMake" OR
-      "${CMAKE_TEST_GENERATOR}" MATCHES "Visual Studio")
-  ENDIF(MSVC AND NOT CMAKE_TEST_DIFFERENT_GENERATOR)
-
-  SET(CMAKE_TEST_SYSTEM_LIBRARIES 0)
-  FOREACH(util CURL EXPAT XMLRPC ZLIB)
-    IF(CMAKE_USE_SYSTEM_${util})
-      SET(CMAKE_TEST_SYSTEM_LIBRARIES 1)
-    ENDIF(CMAKE_USE_SYSTEM_${util})
-  ENDFOREACH(util)
-
-  # This variable is set by cmake, however to
-  # test cmake we want to make sure that
-  # the ctest from this cmake is used for testing
-  # and not the ctest from the cmake building and testing
-  # cmake.
-  SET(CMAKE_CTEST_COMMAND "${EXECUTABLE_OUTPUT_PATH}/ctest")
-  SET(CMAKE_CMAKE_COMMAND "${EXECUTABLE_OUTPUT_PATH}/cmake")
-
   # Should the long tests be run?
   OPTION(CMAKE_RUN_LONG_TESTS "Should the long tests be run (such as Bootstrap)." ON)
   MARK_AS_ADVANCED(CMAKE_RUN_LONG_TESTS)

Index: cmake.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmake.cxx,v
retrieving revision 1.283
retrieving revision 1.284
diff -u -d -r1.283 -r1.284
--- cmake.cxx	27 Feb 2007 21:41:43 -0000	1.283
+++ cmake.cxx	28 Feb 2007 17:25:19 -0000	1.284
@@ -2915,10 +2915,8 @@
 
 int cmake::GetSystemInformation(std::vector<std::string>& args)
 {
-  // we must create a temporary directory, copy some files to it
-  // run cmake on it, and then collect the results.
-  
   // so create the directory
+  std::string resultFile;
   std::string cwd = cmSystemTools::GetCurrentWorkingDirectory();
   std::string destPath = cwd + "/__cmake_systeminformation";
   cmSystemTools::RemoveADirectory(destPath.c_str());
@@ -2928,7 +2926,53 @@
       "writable directory!\n";
     return 1;
     }
-  
+
+  // process the arguments
+  for(unsigned int i=1; i < args.size(); ++i)
+    {
+    std::string arg = args[i];
+    if(arg.find("-V",0) == 0)
+      {
+      this->Verbose = true;
+      }
+    else if(arg.find("-G",0) == 0)
+      {
+      std::string value = arg.substr(2);
+      if(value.size() == 0)
+        {
+        ++i;
+        if(i >= args.size())
+          {
+          cmSystemTools::Error("No generator specified for -G");
+          return -1;
+          }
+        value = args[i];
+        }
+      cmGlobalGenerator* gen =
+        this->CreateGlobalGenerator(value.c_str());
+      if(!gen)
+        {
+        cmSystemTools::Error("Could not create named generator ",
+                             value.c_str());
+        }
+      else
+        {
+        this->SetGlobalGenerator(gen);
+        }
+      }
+    // no option assume it is the output file
+    else
+      {
+      if (!cmSystemTools::FileIsFullPath(arg.c_str()))
+        {
+        resultFile += cwd;
+        resultFile += "/";
+        }
+      resultFile = arg;
+      }
+    }
+
+
   // we have to find the module directory, so we can copy the files
   this->AddCMakePaths(args[0].c_str());
   std::string modulesPath = 
@@ -2948,22 +2992,11 @@
     }
   
   // do we write to a file or to stdout?
-  std::string resultFile;
-
-  if (args.size() == 1)
+  if (resultFile.size() == 0)
     {
     resultFile = cwd;
     resultFile += "/__cmake_systeminformation/results.txt";
     }
-  else
-    {
-    if (!cmSystemTools::FileIsFullPath(args[1].c_str()))
-      {
-      resultFile += cwd;
-      resultFile += "/";
-      }
-    resultFile = args[1];
-    }
 
   // now run cmake on the CMakeLists file
   cmSystemTools::ChangeDirectory(destPath.c_str());



More information about the Cmake-commits mailing list