From b545988c0b33cefccbc78bdaa97fe268a5176754 Mon Sep 17 00:00:00 2001 From: Bill Hoffman Date: Mon, 3 Dec 2001 17:00:43 -0500 Subject: ENH: add -C load cache file option --- Source/cmake.cxx | 30 +++++++++++++++++++++++------- 1 file changed, 23 insertions(+), 7 deletions(-) diff --git a/Source/cmake.cxx b/Source/cmake.cxx index 7af6931..3c40885 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -66,10 +66,13 @@ void cmake::Usage(const char* program) { std::cerr << "cmake version " << cmMakefile::GetMajorVersion() << "." << cmMakefile::GetMinorVersion() << "\n"; - std::cerr << "Usage: " << program << " srcdir [options]\n" - << "Where cmake is run from the directory where you want the object files written\n"; + std::cerr << "Usage: " << program << " [srcdir] [options]\n" + << "Where cmake is run from the directory where you want the object files written. If srcdir is not specified, the current directory is used for both source and object files.\n"; std::cerr << "Options are:\n"; - std::cerr << "[-GgeneratorName] (where generator name can be one of these: "; + std::cerr << "\n-i (puts cmake in wizard mode, not available for ccmake)\n"; + std::cerr << "\n-DVAR:TYPE=VALUE (create a cache file entry)\n"; + std::cerr << "\n-Cpath_to_initial_cache (a cmake list file that is used to pre-load the cache with values.)\n"; + std::cerr << "\n[-GgeneratorName] (where generator name can be one of these: "; std::vector names; cmMakefileGenerator::GetRegisteredGenerators(names); for(std::vector::iterator i =names.begin(); @@ -77,13 +80,12 @@ void cmake::Usage(const char* program) { std::cerr << "\"" << i->c_str() << "\" "; } - std::cerr << ")"; - std::cerr << "\n-DVAR:TYPE=VALUE (create a cache file entry)"; - std::cerr << "\n-i (puts cmake in wizard mode, not available for ccmake)\n"; + std::cerr << ")\n"; } // Parse the args -void cmake::SetCacheArgs(cmMakefile& , const std::vector& args) +void cmake::SetCacheArgs(cmMakefile& builder, + const std::vector& args) { for(unsigned int i=1; i < args.size(); ++i) { @@ -107,6 +109,16 @@ void cmake::SetCacheArgs(cmMakefile& , const std::vector& args) << "Should be: VAR:type=value\n"; } } + else if(arg.find("-C",0) == 0) + { + std::string path = arg.substr(2); + std::cerr << "loading initial cache file " << path.c_str() << "\n"; + if(!builder.ReadListFile(path.c_str())) + { + std::cerr << "Error in reading cmake initial cache file:" + << path.c_str() << "\n"; + } + } } } @@ -175,6 +187,10 @@ void cmake::SetArgs(cmMakefile& builder, const std::vector& args) { // skip for now } + else if(arg.find("-C",0) == 0) + { + // skip for now + } else if(arg.find("-G",0) == 0) { std::string value = arg.substr(2); -- cgit v0.12