summaryrefslogtreecommitdiffstats
path: root/Source/cmake.cxx
diff options
context:
space:
mode:
authorDavid Cole <david.cole@kitware.com>2011-02-03 02:17:23 (GMT)
committerDavid Cole <david.cole@kitware.com>2011-02-03 02:19:01 (GMT)
commit106958c047c9af783b0216916c8e0d8c52595ff6 (patch)
treebf0cf3c08822dda3fe0cdf360128f971e89d3e4f /Source/cmake.cxx
parent94d1684a8fd0de4310874cd582636a8e26402da2 (diff)
downloadCMake-106958c047c9af783b0216916c8e0d8c52595ff6.zip
CMake-106958c047c9af783b0216916c8e0d8c52595ff6.tar.gz
CMake-106958c047c9af783b0216916c8e0d8c52595ff6.tar.bz2
Add CMAKE_ARGC and CMAKE_ARGV0..N-1 variables (#2828)
For now, these variables are only available in -P script mode.
Diffstat (limited to 'Source/cmake.cxx')
-rw-r--r--Source/cmake.cxx13
1 files changed, 8 insertions, 5 deletions
diff --git a/Source/cmake.cxx b/Source/cmake.cxx
index e063ea6..215971f 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,13 @@ 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();
@@ -515,6 +515,8 @@ void cmake::ReadListFile(const char *path)
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))
{
@@ -2203,13 +2205,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();
@@ -2218,7 +2221,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());
}
}
}