Procházet zdrojové kódy

changes for cmake to live outside of the source tree

Ken Martin před 25 roky
rodič
revize
7ec7fb7e95

+ 9 - 0
Source/cmMSProjectGenerator.cxx

@@ -73,3 +73,12 @@ void cmMSProjectGenerator::SetLocal(bool local)
 {
   m_BuildDSW = !local;
 }
+
+void cmMSProjectGenerator::ComputeSystemInfo()
+{
+  // now load the settings
+  std::string fpath = 
+    cmCacheManager::GetInstance()->GetCacheValue("CMAKE_ROOT");
+  fpath += "/CMakeWindowsSystemConfig.cmake";
+  m_Makefile->ReadListFile(NULL,fpath.c_str());
+}

+ 6 - 0
Source/cmMSProjectGenerator.h

@@ -98,6 +98,12 @@ public:
   cmDSPMakefile* GetDSPMakefile() 
     {return m_DSPMakefile;}
 
+  /**
+   * Try to determine system infomation such as shared library
+   * extension, pthreads, byte order etc.  
+   */
+  virtual void ComputeSystemInfo();
+
 private:
   cmDSWMakefile* m_DSWMakefile;
   cmDSPMakefile* m_DSPMakefile;

+ 6 - 0
Source/cmMakefileGenerator.h

@@ -76,6 +76,12 @@ public:
    */
   virtual void SetLocal(bool ) {};
 
+  /**
+   * Try to determine system infomation such as shared library
+   * extension, pthreads, byte order etc.  
+   */
+  virtual void ComputeSystemInfo() = 0;
+
 protected:
   cmMakefile* m_Makefile;
 };

+ 22 - 8
Source/cmUnixMakefileGenerator.cxx

@@ -755,7 +755,7 @@ void cmUnixMakefileGenerator::OutputMakeVariables(std::ostream& fout)
     "THREAD_LIBS          = @CMAKE_THREAD_LIBS@\n"
     "\n"
     "# set up the path to the rulesgen program\n"
-    "CMAKE_COMMAND = ${CMAKE_BINARY_DIR}/CMake/Source/CMakeBuildTargets\n"
+    "CMAKE_COMMAND = ${CMAKE_COMMAND}\n"
     "\n"
     "\n"
     "\n";
@@ -793,12 +793,6 @@ void cmUnixMakefileGenerator::OutputMakeRules(std::ostream& fout)
                        "all",
                        "Makefile cmake.depends ${TARGETS} ${SUBDIR_BUILD} ${CMAKE_COMMAND}",
                        0);
-  this->OutputMakeRule(fout, 
-                       "rule to build cmake from source",
-                       "${CMAKE_COMMAND}", "${CMAKE_SOURCE_DIR}/CMake/Source/*.cxx "
-                       "${CMAKE_SOURCE_DIR}/CMake/Source/*.h",
-                       "cd ${CMAKE_BINARY_DIR}/CMake/Source; "
-                       "${MAKE} CMakeBuildTargets");
   this->OutputMakeRule(fout, 
                        "remove generated files",
                        "clean",
@@ -830,7 +824,7 @@ void cmUnixMakefileGenerator::OutputMakeRules(std::ostream& fout)
                        "rebuild_cache",
                        "${CMAKE_BINARY_DIR}/CMakeCache.txt",
                        "${CMAKE_COMMAND} ${CMAKE_SOURCE_DIR}/CMakeLists.txt "
-                       "-MakeCache -S${CMAKE_SOURCE_DIR} -O${CMAKE_BINARY_DIR} "
+                       "-S${CMAKE_SOURCE_DIR} -O${CMAKE_BINARY_DIR} "
                        "-H${CMAKE_SOURCE_DIR} -B${CMAKE_BINARY_DIR}");
   
 }
@@ -889,3 +883,23 @@ void cmUnixMakefileGenerator::SetLocal (bool local)
     m_Recurse = true;
     }
 }
+
+void cmUnixMakefileGenerator::ComputeSystemInfo()
+{
+  if (m_CacheOnly)
+    {
+      // currently we run configure shell script here to determine the info
+      std::string output;
+      std::string cmd;
+      const char* root
+	= cmCacheManager::GetInstance()->GetCacheValue("CMAKE_ROOT");
+      cmd = root;
+      cmd += "/Templates/configure";
+      cmSystemTools::RunCommand(cmd.c_str(), output);
+    }
+
+  // now load the settings
+  std::string fpath = m_Makefile->GetHomeOutputDirectory();
+  fpath += "/CMakeSystemConfig.cmake";
+  m_Makefile->ReadListFile(NULL,fpath.c_str());
+}

+ 6 - 0
Source/cmUnixMakefileGenerator.h

@@ -84,6 +84,12 @@ public:
    */
   void OutputObjectDepends(std::ostream&);
 
+  /**
+   * Try to determine system infomation such as shared library
+   * extension, pthreads, byte order etc.  
+   */
+  virtual void ComputeSystemInfo();
+
 private:
   void RecursiveGenerateCacheOnly();
   void GenerateCacheOnly();