From a8226e91d75e595248a176966f3f645203f12072 Mon Sep 17 00:00:00 2001 From: Brad King Date: Fri, 18 Oct 2013 13:30:43 -0400 Subject: cmake: Drop support for "-i" wizard mode Tell users to pass cache values with the -D option on the command line or use cmake-gui or ccmake. --- Help/manual/cmake.1.rst | 6 -- Source/CMakeLists.txt | 2 - Source/cmCacheManager.h | 1 - Source/cmakemain.cxx | 14 ++-- Source/cmakewizard.cxx | 155 -------------------------------------------- Source/cmakewizard.h | 42 ------------ Tests/CMakeLists.txt | 9 ++- Tests/CMakeWizardTest.cmake | 52 --------------- bootstrap | 1 - 9 files changed, 9 insertions(+), 273 deletions(-) delete mode 100644 Source/cmakewizard.cxx delete mode 100644 Source/cmakewizard.h delete mode 100644 Tests/CMakeWizardTest.cmake diff --git a/Help/manual/cmake.1.rst b/Help/manual/cmake.1.rst index 64d0fb3..46190b5 100644 --- a/Help/manual/cmake.1.rst +++ b/Help/manual/cmake.1.rst @@ -36,12 +36,6 @@ native tool on their platform. are available. On Windows: comspec, delete_regv, write_regv. On UNIX: create_symlink. -* ``-i``: Run in wizard mode. - - Wizard mode runs cmake interactively without a GUI. The user is - prompted to answer questions about the project configuration. The - answers are used to set cmake cache values. - * ``-L[A][H]``: List non-advanced cached variables. List cache variables will run CMake and list all the variables from diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt index 71fae58..288e867 100644 --- a/Source/CMakeLists.txt +++ b/Source/CMakeLists.txt @@ -281,8 +281,6 @@ set(SRCS cmXMLSafe.h cmake.cxx cmake.h - cmakewizard.cxx - cmakewizard.h cm_sha2.h cm_sha2.c diff --git a/Source/cmCacheManager.h b/Source/cmCacheManager.h index 2eb440a..4b8c07d 100644 --- a/Source/cmCacheManager.h +++ b/Source/cmCacheManager.h @@ -179,7 +179,6 @@ private: // the commands should never use the cmCacheManager directly friend class cmMakefile; // allow access to add cache values friend class cmake; // allow access to add cache values - friend class cmakewizard; // allow access to add cache values friend class cmMarkAsAdvancedCommand; // allow access to add cache values }; diff --git a/Source/cmakemain.cxx b/Source/cmakemain.cxx index 5113a75..e86c2cf 100644 --- a/Source/cmakemain.cxx +++ b/Source/cmakemain.cxx @@ -20,7 +20,6 @@ #include "cmcmd.h" #include "cmCacheManager.h" #include "cmListFileCache.h" -#include "cmakewizard.h" #include "cmSourceFile.h" #include "cmGlobalGenerator.h" #include "cmLocalGenerator.h" @@ -61,7 +60,6 @@ static const char * cmDocumentationOptions[][2] = { CMAKE_STANDARD_OPTIONS_TABLE, {"-E", "CMake command mode."}, - {"-i", "Run in wizard mode."}, {"-L[A][H]", "List non-advanced cached variables."}, {"--build ", "Build a CMake-generated project binary tree."}, {"-N", "View mode only."}, @@ -236,7 +234,6 @@ int do_cmake(int ac, char** av) } #endif - bool wiz = false; bool sysinfo = false; bool list_cached = false; bool list_all_cached = false; @@ -248,7 +245,11 @@ int do_cmake(int ac, char** av) { if(strcmp(av[i], "-i") == 0) { - wiz = true; + std::cerr << + "The \"cmake -i\" wizard mode is no longer supported.\n" + "Use the -D option to set cache values on the command line.\n" + "Use cmake-gui or ccmake for an interactive dialog.\n"; + return 1; } else if(strcmp(av[i], "--system-information") == 0) { @@ -301,11 +302,6 @@ int do_cmake(int ac, char** av) args.push_back(av[i]); } } - if (wiz) - { - cmakewizard wizard; - return wizard.RunWizard(args); - } if (sysinfo) { cmake cm; diff --git a/Source/cmakewizard.cxx b/Source/cmakewizard.cxx deleted file mode 100644 index bac403a..0000000 --- a/Source/cmakewizard.cxx +++ /dev/null @@ -1,155 +0,0 @@ -/*============================================================================ - CMake - Cross Platform Makefile Generator - Copyright 2000-2009 Kitware, Inc., Insight Software Consortium - - Distributed under the OSI-approved BSD License (the "License"); - see accompanying file Copyright.txt for details. - - This software is distributed WITHOUT ANY WARRANTY; without even the - implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - See the License for more information. -============================================================================*/ -#include "cmakewizard.h" -#include "cmake.h" -#include "cmCacheManager.h" - -cmakewizard::cmakewizard() -{ - this->ShowAdvanced = false; -} - - -void cmakewizard::AskUser(const char* key, - cmCacheManager::CacheIterator& iter) -{ - printf("Variable Name: %s\n", key); - const char* helpstring = iter.GetProperty("HELPSTRING"); - printf("Description: %s\n", (helpstring?helpstring:"(none)")); - printf("Current Value: %s\n", iter.GetValue()); - printf("New Value (Enter to keep current value): "); - char buffer[4096]; - if(!fgets(buffer, static_cast(sizeof(buffer) - 1), stdin)) - { - buffer[0] = 0; - } - - if(strlen(buffer) > 0) - { - std::string sbuffer = buffer; - std::string::size_type pos = sbuffer.find_last_not_of(" \n\r\t"); - std::string value = ""; - if ( pos != std::string::npos ) - { - value = sbuffer.substr(0, pos+1); - } - - if ( value.size() > 0 ) - { - if(iter.GetType() == cmCacheManager::PATH || - iter.GetType() == cmCacheManager::FILEPATH) - { - cmSystemTools::ConvertToUnixSlashes(value); - } - if(iter.GetType() == cmCacheManager::BOOL) - { - if(!cmSystemTools::IsOn(value.c_str())) - { - value = "OFF"; - } - } - iter.SetValue(value.c_str()); - } - } - printf("\n"); -} - -bool cmakewizard::AskAdvanced() -{ - printf("Would you like to see advanced options? [No]:"); - char buffer[4096]; - if(!fgets(buffer, static_cast(sizeof(buffer) - 1), stdin)) - { - buffer[0] = 0; - } - else if(buffer[0] == 'y' || buffer[0] == 'Y') - { - return true; - } - return false; -} - - -void cmakewizard::ShowMessage(const char* m) -{ - printf("%s\n", m); -} - - - -int cmakewizard::RunWizard(std::vector const& args) -{ - this->ShowAdvanced = this->AskAdvanced(); - cmSystemTools::DisableRunCommandOutput(); - cmake make; - make.SetArgs(args); - make.SetCMakeCommand(args[0].c_str()); - make.LoadCache(); - make.SetCacheArgs(args); - std::map askedCache; - bool asked = false; - // continue asking questions until no new questions are asked - do - { - asked = false; - // run cmake - this->ShowMessage( - "Please wait while cmake processes CMakeLists.txt files....\n"); - - make.Configure(); - this->ShowMessage("\n"); - // load the cache from disk - cmCacheManager *cachem = make.GetCacheManager(); - cachem->LoadCache(make.GetHomeOutputDirectory()); - cmCacheManager::CacheIterator i = cachem->NewIterator(); - // iterate over all entries in the cache - for(;!i.IsAtEnd(); i.Next()) - { - std::string key = i.GetName(); - if( i.GetType() == cmCacheManager::INTERNAL || - i.GetType() == cmCacheManager::STATIC || - i.GetType() == cmCacheManager::UNINITIALIZED ) - { - continue; - } - if(askedCache.count(key)) - { - std::string& e = askedCache.find(key)->second; - if(e != i.GetValue()) - { - if(this->ShowAdvanced || !i.GetPropertyAsBool("ADVANCED")) - { - this->AskUser(key.c_str(), i); - asked = true; - } - } - } - else - { - if(this->ShowAdvanced || !i.GetPropertyAsBool("ADVANCED")) - { - this->AskUser(key.c_str(), i); - asked = true; - } - } - askedCache[key] = i.GetValue(); - } - cachem->SaveCache(make.GetHomeOutputDirectory()); - } - while(asked); - if(make.Generate() == 0) - { - this->ShowMessage("CMake complete, run make to build project.\n"); - return 0; - } - return 1; -} diff --git a/Source/cmakewizard.h b/Source/cmakewizard.h deleted file mode 100644 index 0c8dba9..0000000 --- a/Source/cmakewizard.h +++ /dev/null @@ -1,42 +0,0 @@ -/*============================================================================ - CMake - Cross Platform Makefile Generator - Copyright 2000-2009 Kitware, Inc., Insight Software Consortium - - Distributed under the OSI-approved BSD License (the "License"); - see accompanying file Copyright.txt for details. - - This software is distributed WITHOUT ANY WARRANTY; without even the - implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - See the License for more information. -============================================================================*/ - - -#include "cmMakefile.h" - -class cmakewizard -{ -public: - cmakewizard(); - virtual ~cmakewizard() {} - /** - * Prompt the user to see if they want to see advanced entries. - */ - virtual bool AskAdvanced(); - - /** - * Prompt the User for a new value for key, the answer is put in entry. - */ - virtual void AskUser(const char* key, cmCacheManager::CacheIterator& iter); - ///! Show a message to wait for cmake to run. - virtual void ShowMessage(const char*); - - /** - * Run cmake in wizard mode. This will coninue to ask the user questions - * until there are no more entries in the cache. - */ - int RunWizard(std::vectorconst& args); - -private: - bool ShowAdvanced; -}; - diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index 2f6a456..7dee86a 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -2509,11 +2509,10 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/ ) endif() - add_test(CMakeWizardTest ${CMAKE_CMAKE_COMMAND} - -D build_dir:STRING=${CMAKE_CURRENT_BINARY_DIR}/CMakeWizardTest - -D source_dir:STRING=${CMAKE_CURRENT_SOURCE_DIR}/Tutorial/Step3 - -D CMAKE_CTEST_COMMAND:STRING=${CMAKE_CTEST_COMMAND} - -P ${CMAKE_CURRENT_SOURCE_DIR}/CMakeWizardTest.cmake) + add_test(NAME CMakeWizardTest COMMAND cmake -i) + set_property(TEST CMakeWizardTest PROPERTY PASS_REGULAR_EXPRESSION + "The \"cmake -i\" wizard mode is no longer supported.") + # If the cache variable CMAKE_CONTRACT_PROJECTS is set # then the dashboard will run a contract with CMake test of that # name. For example CMAKE_CONTRACT_PROJECTS = vtk542 would run diff --git a/Tests/CMakeWizardTest.cmake b/Tests/CMakeWizardTest.cmake deleted file mode 100644 index bcae8af..0000000 --- a/Tests/CMakeWizardTest.cmake +++ /dev/null @@ -1,52 +0,0 @@ -message("CTEST_FULL_OUTPUT (Avoid ctest truncation of output)") - -message(STATUS "build_dir='${build_dir}'") - -message(STATUS "source_dir='${source_dir}'") - - -execute_process(COMMAND ${CMAKE_COMMAND} -E - remove_directory ${build_dir} - TIMEOUT 5) - -execute_process(COMMAND ${CMAKE_COMMAND} -E - make_directory ${build_dir} - TIMEOUT 5) - -execute_process(COMMAND ${CMAKE_COMMAND} -E - copy_directory ${source_dir} ${build_dir}/src - TIMEOUT 5) - -execute_process(COMMAND ${CMAKE_COMMAND} -E - make_directory ${build_dir}/build - TIMEOUT 5) - -# This is enough to answer 32 questions with "the default answer is ok"... -# -file(WRITE ${build_dir}/input.txt - "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n") - - -message(STATUS "running wizard mode (cmake -i)...") - -execute_process(COMMAND ${CMAKE_COMMAND} -i ../src - INPUT_FILE ${build_dir}/input.txt - WORKING_DIRECTORY ${build_dir}/build - TIMEOUT 5 - ) - - -message(STATUS "building...") - -execute_process(COMMAND ${CMAKE_COMMAND} --build . - WORKING_DIRECTORY ${build_dir}/build - TIMEOUT 5 - ) - - -message(STATUS "testing...") - -execute_process(COMMAND ${CMAKE_CTEST_COMMAND} - WORKING_DIRECTORY ${build_dir}/build - TIMEOUT 5 - ) diff --git a/bootstrap b/bootstrap index f2cfcaa..eafd38a 100755 --- a/bootstrap +++ b/bootstrap @@ -224,7 +224,6 @@ CMAKE_CXX_SOURCES="\ cmStandardIncludes \ cmake \ cmakemain \ - cmakewizard \ cmcmd \ cmCommandArgumentLexer \ cmCommandArgumentParser \ -- cgit v0.12