فهرست منبع

ENH: Add support for automatically preloaded cmake file. Closes Bug #802 - Add auto preload file support in CMake

Andy Cedilnik 21 سال پیش
والد
کامیت
df31c576dc
3فایلهای تغییر یافته به همراه18 افزوده شده و 0 حذف شده
  1. 7 0
      Source/cmake.cxx
  2. 10 0
      Tests/CommandLineTest/CMakeLists.txt
  3. 1 0
      Tests/CommandLineTest/PreLoad.cmake

+ 7 - 0
Source/cmake.cxx

@@ -1160,6 +1160,13 @@ int cmake::Run(const std::vector<std::string>& args, bool noconfigure)
     cmSystemTools::Error("Problem processing arguments. Aborting.\n");
     return -1;
     }
+
+  std::string pre_load = this->GetHomeDirectory();
+  pre_load += "/PreLoad.cmake";
+  if ( cmSystemTools::FileExists(pre_load.c_str()) )
+    {
+    this->ReadListFile(pre_load.c_str());
+    }
  
   std::string systemFile = this->GetHomeOutputDirectory();
   systemFile += "/CMakeSystem.cmake";

+ 10 - 0
Tests/CommandLineTest/CMakeLists.txt

@@ -23,3 +23,13 @@ ELSE(DUMP_DOC_EXE)
 ENDIF(DUMP_DOC_EXE)
 
 ADD_EXECUTABLE(CommandLineTest CommandLineTest.cxx)
+
+IF(THIS_SHOULD_BE_SET)
+  MESSAGE(STATUS "***************************")
+  MESSAGE(STATUS "PreLoad.cmake works fine.")
+  MESSAGE(STATUS "***************************")
+ELSE(THIS_SHOULD_BE_SET)
+  MESSAGE("***************************")
+  MESSAGE(FATAL_ERROR "PreLoad.cmake does not work.")
+ENDIF(THIS_SHOULD_BE_SET)
+  

+ 1 - 0
Tests/CommandLineTest/PreLoad.cmake

@@ -0,0 +1 @@
+SET(THIS_SHOULD_BE_SET ON CACHE BOOL "Some variable")