diff options
author | Brad King <brad.king@kitware.com> | 2011-02-22 19:32:48 (GMT) |
---|---|---|
committer | CMake Topic Stage <kwrobot@kitware.com> | 2011-02-22 19:32:48 (GMT) |
commit | 6250c7324f874060f43cf760d8ad349add7fb5e2 (patch) | |
tree | 222c20c56b64293d6d0b69274862df03ac25b959 /Source/cmake.cxx | |
parent | 6dc8c252266f2464ce8067eea2897818067be53d (diff) | |
parent | a58ace68ce3a0ca69d0f7e3f103eab65d7302a9a (diff) | |
download | CMake-6250c7324f874060f43cf760d8ad349add7fb5e2.zip CMake-6250c7324f874060f43cf760d8ad349add7fb5e2.tar.gz CMake-6250c7324f874060f43cf760d8ad349add7fb5e2.tar.bz2 |
Merge topic 'fix-2828-more-info-in-script-mode'
a58ace6 Fix KWStyle line-too-long complaint (#2828)
106958c Add CMAKE_ARGC and CMAKE_ARGV0..N-1 variables (#2828)
94d1684 Add CMAKE_SCRIPT_MODE_FILE variable (#2828)
Diffstat (limited to 'Source/cmake.cxx')
-rw-r--r-- | Source/cmake.cxx | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/Source/cmake.cxx b/Source/cmake.cxx index 81324b6..ea8cdfd 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -462,7 +462,7 @@ bool cmake::SetCacheArgs(const std::vector<std::string>& args) } } std::cerr << "loading initial cache file " << path.c_str() << "\n"; - this->ReadListFile(path.c_str()); + this->ReadListFile(args, path.c_str()); } else if(arg.find("-P",0) == 0) { @@ -478,13 +478,14 @@ bool cmake::SetCacheArgs(const std::vector<std::string>& args) cmSystemTools::Error("No cmake script provided."); return false; } - this->ReadListFile(path.c_str()); + this->ReadListFile(args, path.c_str()); } } return true; } -void cmake::ReadListFile(const char *path) +void cmake::ReadListFile(const std::vector<std::string>& args, + const char *path) { // if a generator was not yet created, temporarily create one cmGlobalGenerator *gg = this->GetGlobalGenerator(); @@ -510,6 +511,14 @@ void cmake::ReadListFile(const char *path) (cmSystemTools::GetCurrentWorkingDirectory().c_str()); lg->GetMakefile()->SetStartDirectory (cmSystemTools::GetCurrentWorkingDirectory().c_str()); + if (this->GetScriptMode()) + { + std::string file(cmSystemTools::CollapseFullPath(path)); + cmSystemTools::ConvertToUnixSlashes(file); + lg->GetMakefile()->SetScriptModeFile(file.c_str()); + + lg->GetMakefile()->SetArgcArgv(args); + } if (!lg->GetMakefile()->ReadListFile(0, path)) { cmSystemTools::Error("Error processing file:", path); @@ -2223,13 +2232,14 @@ int cmake::ActualConfigure() void cmake::PreLoadCMakeFiles() { + std::vector<std::string> args; std::string pre_load = this->GetHomeDirectory(); if ( pre_load.size() > 0 ) { pre_load += "/PreLoad.cmake"; if ( cmSystemTools::FileExists(pre_load.c_str()) ) { - this->ReadListFile(pre_load.c_str()); + this->ReadListFile(args, pre_load.c_str()); } } pre_load = this->GetHomeOutputDirectory(); @@ -2238,7 +2248,7 @@ void cmake::PreLoadCMakeFiles() pre_load += "/PreLoad.cmake"; if ( cmSystemTools::FileExists(pre_load.c_str()) ) { - this->ReadListFile(pre_load.c_str()); + this->ReadListFile(args, pre_load.c_str()); } } } |