diff options
author | Ken Martin <ken.martin@kitware.com> | 2002-05-15 21:23:09 (GMT) |
---|---|---|
committer | Ken Martin <ken.martin@kitware.com> | 2002-05-15 21:23:09 (GMT) |
commit | 1052a6700f46588258682a266aa84e28aa36625f (patch) | |
tree | 430bab4a88a0136d68bab28df785a3dbdeeab3c0 /Source | |
parent | e10cea0da4b078369c7329f83b915f3bdc58bee0 (diff) | |
download | CMake-1052a6700f46588258682a266aa84e28aa36625f.zip CMake-1052a6700f46588258682a266aa84e28aa36625f.tar.gz CMake-1052a6700f46588258682a266aa84e28aa36625f.tar.bz2 |
added initial attempt to support win32 bootstrapping
Diffstat (limited to 'Source')
-rw-r--r-- | Source/cmake.cxx | 65 | ||||
-rw-r--r-- | Source/cmake.h | 8 |
2 files changed, 72 insertions, 1 deletions
diff --git a/Source/cmake.cxx b/Source/cmake.cxx index c9a438c..b5b6883 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -327,6 +327,13 @@ void cmake::AddCMakePaths(const std::vector<std::string>& args) cMakeRoot += "/share/CMake"; modules = cMakeRoot + "/Modules/FindVTK.cmake"; } + if(!cmSystemTools::FileExists(modules.c_str())) + { + // next try exe + cMakeRoot = cmSystemTools::GetProgramPath(cMakeSelf.c_str()); + // is there no Modules direcory there? + modules = cMakeRoot + "/Modules/FindVTK.cmake"; + } if (!cmSystemTools::FileExists(modules.c_str())) { // couldn't find modules @@ -339,7 +346,58 @@ void cmake::AddCMakePaths(const std::vector<std::string>& args) ("CMAKE_ROOT", cMakeRoot.c_str(), "Path to CMake installation.", cmCacheManager::INTERNAL); } - + + +void cmake::HandleBootstrap(cmMakefile& mf, const std::string& args0) +{ + if (cmSystemTools::GetFilenameNameWithoutExtension(args0) == + "bootstrap") + { + int done = 0; + + while (!done) + { + int choice = 0; + std::cout << + "\n\nPlease select the tool you wish to use to build CMake." + "\nPlease note that selecting a tool here will not limit" + "\nwhat tools the resulting CMake executable supports.\n\n"; + std::vector<std::string> names; + cmMakefileGenerator::GetRegisteredGenerators(names); + int count = 1; + for(std::vector<std::string>::iterator i =names.begin(); + i != names.end(); ++i, ++count) + { + std::cout << "\t" << count << ") " << i->c_str() << "\n"; + } + std::cin >> choice; + if (choice > 0 && choice < count) + { + done = 1; + cmMakefileGenerator* gen = + cmMakefileGenerator::CreateGenerator(names[choice-1].c_str()); + if(!gen) + { + cmSystemTools::Error("Could not create named generator ", + names[choice-1].c_str()); + } + else + { + mf.SetMakefileGenerator(gen); + mf.AddDefinition("CMAKE_BOOTSTRAP","1"); + std::cout << + "\n\nThank You. CMake will now generate the appropriate files for\nbeing built with " << names[choice-1].c_str() << "\n\n"; + } + } + else + { + std::cout << "Please make a selection between 1 and " << + count -1 << "\n"; + } + } + } +} + int cmake::Generate(const std::vector<std::string>& args, bool buildMakefiles) { if(args.size() == 1 && !cmSystemTools::FileExists("CMakeLists.txt")) @@ -390,6 +448,11 @@ int cmake::Generate(const std::vector<std::string>& args, bool buildMakefiles) // extract command line arguments that might add cache entries this->SetCacheArgs(mf, args); + + // handle bootstraping command + this->HandleBootstrap(mf,args[0]); + + // no generator specified on the command line if(!mf.GetMakefileGenerator()) { diff --git a/Source/cmake.h b/Source/cmake.h index 53203e3..32efd86 100644 --- a/Source/cmake.h +++ b/Source/cmake.h @@ -52,6 +52,14 @@ class cmake void AddCMakePaths(const std::vector<std::string>&); /** + * Handle the case where cmake is being used to bootstrap itself. + * This typically happens on windows, where a cmake executable is + * used to produce makefiles for cmake itself. When bootstrapping + * CMAKE_BOOTSTRAP is set to 1 + */ + void HandleBootstrap(cmMakefile& builder, const std::string& arg0); + + /** * constructor */ cmake(); |