From df31c576dcfdbb7b7b9e2ba26498bae5af9f4e93 Mon Sep 17 00:00:00 2001 From: Andy Cedilnik Date: Wed, 28 Apr 2004 10:52:20 -0400 Subject: [PATCH] ENH: Add support for automatically preloaded cmake file. Closes Bug #802 - Add auto preload file support in CMake --- Source/cmake.cxx | 7 +++++++ Tests/CommandLineTest/CMakeLists.txt | 10 ++++++++++ Tests/CommandLineTest/PreLoad.cmake | 1 + 3 files changed, 18 insertions(+) create mode 100644 Tests/CommandLineTest/PreLoad.cmake diff --git a/Source/cmake.cxx b/Source/cmake.cxx index 121e0dfb1..3a4a0d55d 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -1160,6 +1160,13 @@ int cmake::Run(const std::vector& 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"; diff --git a/Tests/CommandLineTest/CMakeLists.txt b/Tests/CommandLineTest/CMakeLists.txt index be36860c1..73b8a4788 100644 --- a/Tests/CommandLineTest/CMakeLists.txt +++ b/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) + diff --git a/Tests/CommandLineTest/PreLoad.cmake b/Tests/CommandLineTest/PreLoad.cmake new file mode 100644 index 000000000..87284aff0 --- /dev/null +++ b/Tests/CommandLineTest/PreLoad.cmake @@ -0,0 +1 @@ +SET(THIS_SHOULD_BE_SET ON CACHE BOOL "Some variable")