diff options
Diffstat (limited to 'Source')
-rw-r--r-- | Source/CMakeLists.txt | 1 | ||||
-rw-r--r-- | Source/MFCDialog/CMakeSetup.rc | 14 | ||||
-rw-r--r-- | Source/MFCDialog/CMakeSetupDialog.cpp | 117 | ||||
-rw-r--r-- | Source/MFCDialog/CMakeSetupDialog.h | 5 | ||||
-rw-r--r-- | Source/MFCDialog/resource.h | 3 | ||||
-rw-r--r-- | Source/cmCacheManager.cxx | 10 | ||||
-rw-r--r-- | Source/cmCacheManager.h | 3 | ||||
-rw-r--r-- | Source/cmCommands.cxx | 2 | ||||
-rw-r--r-- | Source/cmMarkAsAdvancedCommand.cxx | 63 | ||||
-rw-r--r-- | Source/cmMarkAsAdvancedCommand.h | 104 | ||||
-rw-r--r-- | Source/cmSystemTools.cxx | 5 | ||||
-rw-r--r-- | Source/cmSystemTools.h | 4 | ||||
-rw-r--r-- | Source/cmUnixMakefileGenerator.cxx | 2 | ||||
-rw-r--r-- | Source/cmakewizard.cxx | 108 |
14 files changed, 431 insertions, 10 deletions
diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt index ad340db..90dd1c6 100644 --- a/Source/CMakeLists.txt +++ b/Source/CMakeLists.txt @@ -67,6 +67,7 @@ LINK_LIBRARIES(CMakeLib) LINK_DIRECTORIES(${CMake_BINARY_DIR}/Source) ADD_EXECUTABLE(cmake cmakemain) +ADD_EXECUTABLE(cmakewizard cmakewizard) ADD_EXECUTABLE(DumpDocumentation cmDumpDocumentation) ADD_EXECUTABLE(ctest ctest.cxx cmSystemTools.cxx cmRegularExpression.cxx) diff --git a/Source/MFCDialog/CMakeSetup.rc b/Source/MFCDialog/CMakeSetup.rc index 0d799e8..8d0eeb4 100644 --- a/Source/MFCDialog/CMakeSetup.rc +++ b/Source/MFCDialog/CMakeSetup.rc @@ -85,7 +85,7 @@ BEGIN DEFPUSHBUTTON "OK",IDOK,178,7,50,14,WS_GROUP END -IDD_CMakeSetupDialog_DIALOG DIALOGEX 0, 0, 389, 241 +IDD_CMakeSetupDialog_DIALOG DIALOGEX 0, 0, 423, 241 STYLE WS_MINIMIZEBOX | WS_MAXIMIZEBOX | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME EXSTYLE WS_EX_APPWINDOW @@ -100,20 +100,22 @@ BEGIN PUSHBUTTON "Browse...",IDC_BUTTON3,230,25,34,13 DEFPUSHBUTTON "Configure",IDC_BuildProjects,70,223,67,15 PUSHBUTTON "Cancel",IDCANCEL,202,223,67,15 - LISTBOX IDC_LIST2,15,55,356,122,LBS_OWNERDRAWVARIABLE | + LISTBOX IDC_LIST2,15,53,393,126,LBS_OWNERDRAWVARIABLE | LBS_HASSTRINGS | LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_HSCROLL RTEXT "Where is the source code:",IDC_STATIC,6,7,86,9 RTEXT "Where to build the binaries:",IDC_STATIC,5,27,90,9 - GROUPBOX "Cache Values",IDC_FRAME,9,43,369,141 + GROUPBOX "Cache Values",IDC_FRAME,9,44,406,140 LTEXT "Right click on a cache value for additional options and help.\nPress Configure to update and display new values in red.\nPress OK to generate selected build files and exit.", IDC_MouseHelpCaption,103,190,197,27 LTEXT "Static",IDC_CMAKE_VERSION,3,227,52,13,SS_CENTERIMAGE PUSHBUTTON "OK",IDC_OK,142,223,56,14 - COMBOBOX IDC_Generator,275,25,103,50,CBS_DROPDOWN | CBS_SORT | + COMBOBOX IDC_Generator,311,7,103,50,CBS_DROPDOWN | CBS_SORT | WS_VSCROLL | WS_TABSTOP - LTEXT "Build For:",IDC_GeneratorLabel,279,10,103,12 + LTEXT "Build For:",IDC_GeneratorLabel,277,9,31,9 PUSHBUTTON "Help",IDC_HELP_BUTTON,274,223,57,15 + CONTROL "Show Advanced Values",IDC_AdvancedValues,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,277,28,98,9 END IDD_CMAKE_HELP_DIALOG DIALOG DISCARDABLE 0, 0, 365, 183 @@ -188,7 +190,7 @@ BEGIN IDD_CMakeSetupDialog_DIALOG, DIALOG BEGIN - RIGHTMARGIN, 388 + RIGHTMARGIN, 418 BOTTOMMARGIN, 238 END diff --git a/Source/MFCDialog/CMakeSetupDialog.cpp b/Source/MFCDialog/CMakeSetupDialog.cpp index 705d830..fab7aef 100644 --- a/Source/MFCDialog/CMakeSetupDialog.cpp +++ b/Source/MFCDialog/CMakeSetupDialog.cpp @@ -87,6 +87,7 @@ CMakeSetupDialog::CMakeSetupDialog(const CMakeCommandLineInfo& cmdInfo, m_WhereSource = cmdInfo.m_WhereSource; m_WhereBuild = cmdInfo.m_WhereBuild; m_GeneratorChoiceString = _T(""); + m_AdvancedValues = FALSE; //}}AFX_DATA_INIT // Note that LoadIcon does not require a subsequent DestroyIcon in Win32 m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME); @@ -121,6 +122,7 @@ void CMakeSetupDialog::DoDataExchange(CDataExchange* pDX) DDX_Control(pDX, IDC_CMAKE_VERSION, m_VersionDisplay); DDX_Control(pDX, IDC_BuildProjects, m_Configure); DDX_CBStringExact(pDX, IDC_Generator, m_GeneratorChoiceString); + DDX_Check(pDX, IDC_AdvancedValues, m_AdvancedValues); //}}AFX_DATA_MAP } @@ -140,8 +142,10 @@ BEGIN_MESSAGE_MAP(CMakeSetupDialog, CDialog) ON_WM_GETMINMAXINFO() ON_BN_CLICKED(IDC_OK, OnOk) ON_CBN_EDITCHANGE(IDC_Generator, OnEditchangeGenerator) - ON_BN_CLICKED(IDCANCEL, OnCancel) ON_BN_CLICKED(IDC_HELP_BUTTON, OnHelpButton) + ON_BN_CLICKED(IDCANCEL, OnCancel) + ON_BN_CLICKED(IDC_AdvancedValues, OnAdvancedValues) + ON_BN_DOUBLECLICKED(IDC_AdvancedValues, OnDoubleclickedAdvancedValues) //}}AFX_MSG_MAP END_MESSAGE_MAP() @@ -617,6 +621,15 @@ void CMakeSetupDialog::FillCacheGUIFromCacheManager() { const char* key = i->first.c_str(); const cmCacheManager::CacheEntry& value = i->second; + if(!m_AdvancedValues) + { + std::string advancedVar = key; + advancedVar += "-ADVANCED"; + if(cmCacheManager::GetInstance()->GetCacheEntry(advancedVar.c_str())) + { + continue; + } + } switch(value.m_Type ) { case cmCacheManager::BOOL: @@ -1006,3 +1019,105 @@ void CMakeSetupDialog::OnHelpButton() CMakeHelp dialog; dialog.DoModal(); } + +void CMakeSetupDialog::ShowAdvancedValues() +{ + const cmCacheManager::CacheEntryMap &cache = + cmCacheManager::GetInstance()->GetCacheMap(); + + for(cmCacheManager::CacheEntryMap::const_iterator i = cache.begin(); + i != cache.end(); ++i) + { + const char* key = i->first.c_str(); + const cmCacheManager::CacheEntry& value = i->second; + if(!cmCacheManager::GetInstance()->IsAdvanced(key)) + { + continue; + } + switch(value.m_Type ) + { + case cmCacheManager::BOOL: + if(cmSystemTools::IsOn(value.m_Value.c_str())) + { + m_CacheEntriesList.AddProperty(key, + "ON", + value.m_HelpString.c_str(), + CPropertyList::COMBO,"ON|OFF", + true + ); + } + else + { + m_CacheEntriesList.AddProperty(key, + "OFF", + value.m_HelpString.c_str(), + CPropertyList::COMBO,"ON|OFF", + true + ); + } + break; + case cmCacheManager::PATH: + m_CacheEntriesList.AddProperty(key, + value.m_Value.c_str(), + value.m_HelpString.c_str(), + CPropertyList::PATH,"", + true + ); + break; + case cmCacheManager::FILEPATH: + m_CacheEntriesList.AddProperty(key, + value.m_Value.c_str(), + value.m_HelpString.c_str(), + CPropertyList::FILE,"", + true + ); + break; + case cmCacheManager::STRING: + m_CacheEntriesList.AddProperty(key, + value.m_Value.c_str(), + value.m_HelpString.c_str(), + CPropertyList::EDIT,"", + true + ); + break; + case cmCacheManager::INTERNAL: + m_CacheEntriesList.RemoveProperty(key); + break; + } + } +} + +void CMakeSetupDialog::RemoveAdvancedValues() +{ + const cmCacheManager::CacheEntryMap &cache = + cmCacheManager::GetInstance()->GetCacheMap(); + + for(cmCacheManager::CacheEntryMap::const_iterator i = cache.begin(); + i != cache.end(); ++i) + { + const char* key = i->first.c_str(); + const cmCacheManager::CacheEntry& value = i->second; + if(cmCacheManager::GetInstance()->IsAdvanced(key)) + { + m_CacheEntriesList.RemoveProperty(key); + } + } +} + +void CMakeSetupDialog::OnAdvancedValues() +{ + this->UpdateData(); + if(m_AdvancedValues) + { + this->ShowAdvancedValues(); + } + else + { + this->RemoveAdvancedValues(); + } +} + +void CMakeSetupDialog::OnDoubleclickedAdvancedValues() +{ + this->OnAdvancedValues(); +} diff --git a/Source/MFCDialog/CMakeSetupDialog.h b/Source/MFCDialog/CMakeSetupDialog.h index 8c6c210..cf03a31 100644 --- a/Source/MFCDialog/CMakeSetupDialog.h +++ b/Source/MFCDialog/CMakeSetupDialog.h @@ -33,6 +33,8 @@ protected: CString *val, const char *key, const char *aadefault); + void ShowAdvancedValues(); + void RemoveAdvancedValues(); // Dialog Data //{{AFX_DATA(CMakeSetupDialog) enum { IDD = IDD_CMakeSetupDialog_DIALOG }; @@ -51,6 +53,7 @@ protected: CStatic m_VersionDisplay; CButton m_Configure; CString m_GeneratorChoiceString; + BOOL m_AdvancedValues; //}}AFX_DATA // ClassWizard generated virtual function overrides @@ -91,6 +94,8 @@ protected: afx_msg void OnOk(); afx_msg void OnEditchangeGenerator(); afx_msg void OnHelpButton(); + afx_msg void OnAdvancedValues(); + afx_msg void OnDoubleclickedAdvancedValues(); //}}AFX_MSG DECLARE_MESSAGE_MAP() diff --git a/Source/MFCDialog/resource.h b/Source/MFCDialog/resource.h index be740c4..d581f29 100644 --- a/Source/MFCDialog/resource.h +++ b/Source/MFCDialog/resource.h @@ -25,6 +25,7 @@ #define IDC_GeneratorLabel 1020 #define IDC_HELP_BUTTON 1021 #define IDC_EDIT1 1025 +#define IDC_AdvancedValues 1027 // Next default values for new objects // @@ -32,7 +33,7 @@ #ifndef APSTUDIO_READONLY_SYMBOLS #define _APS_NEXT_RESOURCE_VALUE 134 #define _APS_NEXT_COMMAND_VALUE 32771 -#define _APS_NEXT_CONTROL_VALUE 1026 +#define _APS_NEXT_CONTROL_VALUE 1028 #define _APS_NEXT_SYMED_VALUE 102 #endif #endif diff --git a/Source/cmCacheManager.cxx b/Source/cmCacheManager.cxx index a5300b9..c3af5e4 100644 --- a/Source/cmCacheManager.cxx +++ b/Source/cmCacheManager.cxx @@ -524,3 +524,13 @@ void cmCacheManager::AddCacheEntry(const char* key, bool v, } } +bool cmCacheManager::IsAdvanced(const char* key) +{ + std::string advancedVar = key; + advancedVar += "-ADVANCED"; + if(cmCacheManager::GetInstance()->GetCacheEntry(advancedVar.c_str())) + { + return true; + } + return false; +} diff --git a/Source/cmCacheManager.h b/Source/cmCacheManager.h index 154b0ae..ca4a90a 100644 --- a/Source/cmCacheManager.h +++ b/Source/cmCacheManager.h @@ -99,6 +99,8 @@ public: ///! Get a cache entry object for a key CacheEntry *GetCacheEntry(const char *key); + bool IsAdvanced(const char* key); + ///! Remove an entry from the cache void RemoveCacheEntry(const char* key); @@ -128,6 +130,7 @@ 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 }; #endif diff --git a/Source/cmCommands.cxx b/Source/cmCommands.cxx index c51b263..2d8c890 100644 --- a/Source/cmCommands.cxx +++ b/Source/cmCommands.cxx @@ -40,6 +40,7 @@ #include "cmLinkLibrariesCommand.cxx" #include "cmLoadCacheCommand.cxx" #include "cmMakeDirectoryCommand.cxx" +#include "cmMarkAsAdvancedCommand.cxx" #include "cmMessageCommand.cxx" #include "cmOptionCommand.cxx" #include "cmOutputRequiredFilesCommand.cxx" @@ -102,6 +103,7 @@ void GetPredefinedCommands(std::list<cmCommand*>& commands) commands.push_back(new cmLinkLibrariesCommand); commands.push_back(new cmLoadCacheCommand); commands.push_back(new cmMakeDirectoryCommand); + commands.push_back(new cmMarkAsAdvancedCommand); commands.push_back(new cmMessageCommand); commands.push_back(new cmOptionCommand); commands.push_back(new cmOutputRequiredFilesCommand); diff --git a/Source/cmMarkAsAdvancedCommand.cxx b/Source/cmMarkAsAdvancedCommand.cxx new file mode 100644 index 0000000..e88d1e2 --- /dev/null +++ b/Source/cmMarkAsAdvancedCommand.cxx @@ -0,0 +1,63 @@ +/*========================================================================= + + Program: Insight Segmentation & Registration Toolkit + Module: $RCSfile$ + Language: C++ + Date: $Date$ + Version: $Revision$ + +Copyright (c) 2001 Insight Consortium +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + * The name of the Insight Consortium, nor the names of any consortium members, + nor of any contributors, may be used to endorse or promote products derived + from this software without specific prior written permission. + + * Modified source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS ``AS IS'' +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +=========================================================================*/ +#include "cmMarkAsAdvancedCommand.h" + +// cmMarkAsAdvancedCommand +bool cmMarkAsAdvancedCommand::InitialPass(std::vector<std::string> const& args) +{ + if(args.size() < 1 ) + { + this->SetError("called with incorrect number of arguments"); + return false; + } + for(int i =0; i < args.size(); ++i) + { + std::string variable = args[i]; + variable += "-ADVANCED"; + std::string doc = "Advanced flag for variable: "; + doc += args[i]; + m_Makefile->AddCacheDefinition(variable.c_str(), "1", + doc.c_str(), + cmCacheManager::INTERNAL); + } + return true; +} + diff --git a/Source/cmMarkAsAdvancedCommand.h b/Source/cmMarkAsAdvancedCommand.h new file mode 100644 index 0000000..f328667 --- /dev/null +++ b/Source/cmMarkAsAdvancedCommand.h @@ -0,0 +1,104 @@ +/*========================================================================= + + Program: Insight Segmentation & Registration Toolkit + Module: $RCSfile$ + Language: C++ + Date: $Date$ + Version: $Revision$ + +Copyright (c) 2001 Insight Consortium +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + * The name of the Insight Consortium, nor the names of any consortium members, + nor of any contributors, may be used to endorse or promote products derived + from this software without specific prior written permission. + + * Modified source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS ``AS IS'' +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +=========================================================================*/ +#ifndef cmMarkAsAdvancedCommand_h +#define cmMarkAsAdvancedCommand_h + +#include "cmStandardIncludes.h" +#include "cmCommand.h" + +/** \class cmMarkAsAdvancedCommand + * \brief MarkAsAdvanced a CMAKE variable + * + * cmMarkAsAdvancedCommand sets a variable to a value with expansion. + */ +class cmMarkAsAdvancedCommand : public cmCommand +{ +public: + /** + * This is a virtual constructor for the command. + */ + virtual cmCommand* Clone() + { + return new cmMarkAsAdvancedCommand; + } + + /** + * This is called when the command is first encountered in + * the CMakeLists.txt file. + */ + virtual bool InitialPass(std::vector<std::string> const& args); + + /** + * This determines if the command gets propagated down + * to makefiles located in subdirectories. + */ + virtual bool IsInherited() {return true;} + + /** + * The name of the command as specified in CMakeList.txt. + */ + virtual const char* GetName() {return "MARK_AS_ADVANCED";} + + /** + * Succinct documentation. + */ + virtual const char* GetTerseDocumentation() + { + return "Mark a cmake varible as advanced."; + } + + /** + * More documentation. + */ + virtual const char* GetFullDocumentation() + { + return + "MARK_AS_ADVANCED(VAR VAR2 VAR... )\n" + "Mark the named variables as advanced. An advanced variable will not be displayed in" + " any of the cmake GUIs, unless the show advanced option is on."; + } + + cmTypeMacro(cmMarkAsAdvancedCommand, cmCommand); +}; + + + +#endif diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx index 80a9454..c3cd0cc 100644 --- a/Source/cmSystemTools.cxx +++ b/Source/cmSystemTools.cxx @@ -91,6 +91,7 @@ inline int Chdir(const char* dir) } #endif +bool cmSystemTools::s_DisableRunCommandOutput = false; bool cmSystemTools::s_ErrorOccured = false; bool cmSystemTools::s_DisableMessages = false; @@ -925,6 +926,10 @@ bool cmSystemTools::RunCommand(const char* command, { const int BUFFER_SIZE = 4096; char buffer[BUFFER_SIZE]; + if(s_DisableRunCommandOutput) + { + verbose = false; + } #if defined(WIN32) && !defined(__CYGWIN__) std::string commandToFile = command; diff --git a/Source/cmSystemTools.h b/Source/cmSystemTools.h index 9e7fc35..e9f9f29 100644 --- a/Source/cmSystemTools.h +++ b/Source/cmSystemTools.h @@ -287,9 +287,13 @@ public: static void EnableMessages() { s_DisableMessages = false; } static void DisableMessages() { s_DisableMessages = true; } + static void DisableRunCommandOutput() {s_DisableRunCommandOutput = true; } + static void EnableRunCommandOutput() {s_DisableRunCommandOutput = false; } + private: static bool s_ErrorOccured; static bool s_DisableMessages; + static bool s_DisableRunCommandOutput; static ErrorCallback s_ErrorCallback; }; diff --git a/Source/cmUnixMakefileGenerator.cxx b/Source/cmUnixMakefileGenerator.cxx index 340705e..c4d7d2f 100644 --- a/Source/cmUnixMakefileGenerator.cxx +++ b/Source/cmUnixMakefileGenerator.cxx @@ -1663,14 +1663,12 @@ void cmUnixMakefileGenerator::ComputeSystemInfo() { std::string env = "CXX=${CMAKE_CXX_COMPILER}"; m_Makefile->ExpandVariablesInString(env); - std::cout << "Setting: " << env.c_str() << "\n"; putenv(const_cast<char*>(env.c_str())); } if(m_Makefile->GetDefinition("CMAKE_C_COMPILER")) { std::string env = "CC=${CMAKE_C_COMPILER}"; m_Makefile->ExpandVariablesInString(env); - std::cout << "Setting: " << env.c_str() << "\n"; putenv(const_cast<char*>(env.c_str())); } // currently we run configure shell script here to determine the info diff --git a/Source/cmakewizard.cxx b/Source/cmakewizard.cxx new file mode 100644 index 0000000..6542c93 --- /dev/null +++ b/Source/cmakewizard.cxx @@ -0,0 +1,108 @@ +#include "cmCacheManager.h" +#include "cmake.h" + +bool advanced = false; + +void Ask(const char* key, cmCacheManager::CacheEntry & entry) +{ + if(!advanced) + { + if(cmCacheManager::GetInstance()->IsAdvanced(key)) + { + return; + } + } + + std::cout << "Variable Name: " << key << "\n"; + std::cout << "Description: " << entry.m_HelpString << "\n"; + std::cout << "Current Value: " << entry.m_Value.c_str() << "\n"; + std::cout << "New Value (Enter to keep current value): "; + char buffer[4096]; + buffer[0] = 0; + std::cin.getline(buffer, sizeof(buffer)); + if(buffer[0]) + { + cmCacheManager::CacheEntry *entry = + cmCacheManager::GetInstance()->GetCacheEntry(key); + if(entry) + { + entry->m_Value = buffer; + } + else + { + std::cerr << "strange error, should be in cache but is not... " << key << "\n"; + } + } + std::cout << "\n"; +} + + +main(int ac, char** av) +{ + std::vector<std::string> args; + for(int j=0; j < ac; ++j) + { + args.push_back(av[j]); + } + cmSystemTools::DisableRunCommandOutput(); + std::cout << "Would you like to see advanced options? [No]:"; + char buffer[4096]; + buffer[0] = 0; + std::cin.getline(buffer, sizeof(buffer)); + if(buffer[0]) + { + if(buffer[0] == 'y' || buffer[0] == 'Y') + { + advanced = true; + } + } + cmake make; + cmCacheManager::CacheEntryMap askedCache; + bool asked = false; + // continue asking questions until no new questions are asked + do + { + asked = false; + // run cmake + std::cout << "Please wait while cmake processes CMakeLists.txt files....\n"; + make.Generate(args); + std::cout << "\n"; + // load the cache from disk + cmCacheManager::GetInstance()-> + LoadCache(cmSystemTools::GetCurrentWorkingDirectory().c_str()); + cmCacheManager::CacheEntryMap const& currentCache = + cmCacheManager::GetInstance()->GetCacheMap(); + // iterate over all entries in the cache + for(cmCacheManager::CacheEntryMap::const_iterator i = currentCache.begin(); + i != currentCache.end(); ++i) + { + std::string key = i->first; + cmCacheManager::CacheEntry ce = i->second; + if(ce.m_Type == cmCacheManager::INTERNAL + || ce.m_Type == cmCacheManager::STATIC) + { + continue; + } + if(askedCache.count(key)) + { + cmCacheManager::CacheEntry& e = askedCache.find(key)->second; + if(e.m_Value != ce.m_Value) + { + Ask(key.c_str(), ce); + asked = true; + } + } + else + { + Ask(key.c_str(), ce); + asked = true; + } + askedCache[key] = i->second; + } + cmCacheManager::GetInstance()-> + SaveCache(cmSystemTools::GetCurrentWorkingDirectory().c_str()); + + } + while(asked); + std::cout << "CMake complete, run make to build project.\n"; +} |