diff options
author | Ken Martin <ken.martin@kitware.com> | 2007-02-28 17:25:19 (GMT) |
---|---|---|
committer | Ken Martin <ken.martin@kitware.com> | 2007-02-28 17:25:19 (GMT) |
commit | 56e3a35ece5f4db276bd02c9849e7b58ca479970 (patch) | |
tree | d9a3fe19c139564a4a26e029b403484a8569c68a /Source/cmake.cxx | |
parent | b1aae98926b9a6021d6404ce5a5f52eb2d15643d (diff) | |
download | CMake-56e3a35ece5f4db276bd02c9849e7b58ca479970.zip CMake-56e3a35ece5f4db276bd02c9849e7b58ca479970.tar.gz CMake-56e3a35ece5f4db276bd02c9849e7b58ca479970.tar.bz2 |
BUG: allow system information to accept the -G option
Diffstat (limited to 'Source/cmake.cxx')
-rw-r--r-- | Source/cmake.cxx | 65 |
1 files changed, 49 insertions, 16 deletions
diff --git a/Source/cmake.cxx b/Source/cmake.cxx index 3e8e65e..59e81cb 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -2915,10 +2915,8 @@ bool cmake::GetPropertyAsBool(const char* prop) int cmake::GetSystemInformation(std::vector<std::string>& args) { - // we must create a temporary directory, copy some files to it - // run cmake on it, and then collect the results. - // so create the directory + std::string resultFile; std::string cwd = cmSystemTools::GetCurrentWorkingDirectory(); std::string destPath = cwd + "/__cmake_systeminformation"; cmSystemTools::RemoveADirectory(destPath.c_str()); @@ -2928,7 +2926,53 @@ int cmake::GetSystemInformation(std::vector<std::string>& args) "writable directory!\n"; return 1; } - + + // process the arguments + for(unsigned int i=1; i < args.size(); ++i) + { + std::string arg = args[i]; + if(arg.find("-V",0) == 0) + { + this->Verbose = true; + } + else if(arg.find("-G",0) == 0) + { + std::string value = arg.substr(2); + if(value.size() == 0) + { + ++i; + if(i >= args.size()) + { + cmSystemTools::Error("No generator specified for -G"); + return -1; + } + value = args[i]; + } + cmGlobalGenerator* gen = + this->CreateGlobalGenerator(value.c_str()); + if(!gen) + { + cmSystemTools::Error("Could not create named generator ", + value.c_str()); + } + else + { + this->SetGlobalGenerator(gen); + } + } + // no option assume it is the output file + else + { + if (!cmSystemTools::FileIsFullPath(arg.c_str())) + { + resultFile += cwd; + resultFile += "/"; + } + resultFile = arg; + } + } + + // we have to find the module directory, so we can copy the files this->AddCMakePaths(args[0].c_str()); std::string modulesPath = @@ -2948,22 +2992,11 @@ int cmake::GetSystemInformation(std::vector<std::string>& args) } // do we write to a file or to stdout? - std::string resultFile; - - if (args.size() == 1) + if (resultFile.size() == 0) { resultFile = cwd; resultFile += "/__cmake_systeminformation/results.txt"; } - else - { - if (!cmSystemTools::FileIsFullPath(args[1].c_str())) - { - resultFile += cwd; - resultFile += "/"; - } - resultFile = args[1]; - } // now run cmake on the CMakeLists file cmSystemTools::ChangeDirectory(destPath.c_str()); |