ENH: add advanced variable types and command line wizard gui
This commit is contained in:
parent
3e24edcd04
commit
eecf4b9cbf
|
@ -28,10 +28,11 @@ IF(BUILD_TESTING)
|
|||
# to be defined by cmake
|
||||
SET(MAKEPROGRAM ${CMAKE_MAKE_PROGRAM})
|
||||
FIND_PROGRAM(CVSCOMMAND cvs )
|
||||
FIND_PROGRAM(COMPRESSIONCOMMAND NAMES gzip compress zip )
|
||||
FIND_PROGRAM(GUNZIPCOMMAND gunzip )
|
||||
FIND_PROGRAM(JAVACOMMAND java )
|
||||
FIND_PROGRAM(PURIFYCOMMAND purify )
|
||||
FIND_PROGRAM(COMPRESSIONCOMMAND NAMES gzip compress zip
|
||||
DOC "Path to program used to compress files for transfer to the dart server")
|
||||
FIND_PROGRAM(GUNZIPCOMMAND gunzip DOC "Path to gunzip executable")
|
||||
FIND_PROGRAM(JAVACOMMAND java DOC "Path to java command, used by the Dart server to create html.")
|
||||
FIND_PROGRAM(PURIFYCOMMAND purify DOC "Path to Rational purify command, used for memory error detection.")
|
||||
|
||||
# find a tcl shell command
|
||||
IF (UNIX)
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -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()
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
@ -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
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
};
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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";
|
||||
}
|
|
@ -28,6 +28,7 @@ SET (CMAKE_TEMPLATE_FLAGS "@CMAKE_TEMPLATE_FLAGS@" CACHE STRING
|
|||
SET (CMAKE_C_COMPILER "@CC@" CACHE FILEPATH
|
||||
"C compiler used.")
|
||||
SET (CMAKE_C_FLAGS "@CFLAGS@" CACHE STRING "C compiler flags")
|
||||
|
||||
SET (CMAKE_SHLIB_CFLAGS "@CMAKE_SHLIB_CFLAGS@" CACHE STRING
|
||||
"Flag used for building shared library objects" )
|
||||
SET (CMAKE_SHLIB_BUILD_FLAGS "@CMAKE_SHLIB_BUILD_FLAGS@" CACHE STRING
|
||||
|
@ -65,3 +66,41 @@ SET (CMAKE_ANSI_CXXFLAGS @CMAKE_ANSI_CXXFLAGS@ CACHE INTERNAL "What flags ar
|
|||
SET (CMAKE_NO_EXPLICIT_TEMPLATE_INSTANTIATION @CMAKE_NO_EXPLICIT_TEMPLATE_INSTANTIATION@ CACHE INTERNAL "does the compiler not support explicit template instantiation.")
|
||||
FIND_PROGRAM(CMAKE_MAKE_PROGRAM NAMES gmake make )
|
||||
|
||||
# the following variables are advanced
|
||||
MARK_AS_ADVANCED(
|
||||
CMAKE_X_LIBS
|
||||
CMAKE_USE_WIN32_THREADS
|
||||
CMAKE_USE_SPROC
|
||||
CMAKE_USE_PTHREADS
|
||||
CMAKE_SHLIB_SUFFIX
|
||||
CMAKE_MODULE_SUFFIX
|
||||
CMAKE_INSTALL_PREFIX
|
||||
CMAKE_CXX_COMPILER
|
||||
CMAKE_C_COMPILER
|
||||
CMAKE_HP_PTHREADS
|
||||
CMAKE_WORDS_BIGENDIAN
|
||||
CMAKE_LIB_EXT
|
||||
CMAKE_RANLIB
|
||||
CMAKE_AR
|
||||
CMAKE_AR_ARGS
|
||||
CMAKE_TEMPLATE_FLAGS
|
||||
CMAKE_SHLIB_CFLAGS
|
||||
CMAKE_SHLIB_BUILD_FLAGS
|
||||
CMAKE_MODULE_BUILD_FLAGS
|
||||
CMAKE_THREAD_LIBS
|
||||
CMAKE_DL_LIBS
|
||||
CMAKE_SHLIB_LINK_FLAGS
|
||||
CMAKE_MODULE_LINK_FLAGS
|
||||
CMAKE_SHLIB_LD_LIBS
|
||||
CMAKE_SHLIB_RUNTIME_FLAG
|
||||
CMAKE_SHLIB_RUNTIME_SEP
|
||||
CMAKE_X_CFLAGS
|
||||
CMAKE_NO_ANSI_STREAM_HEADERS
|
||||
CMAKE_NO_ANSI_FOR_SCOPE
|
||||
CMAKE_NO_STD_NAMESPACE
|
||||
CMAKE_COMPILER_IS_GNUCXX
|
||||
CMAKE_ANSI_CFLAGS
|
||||
CMAKE_ANSI_CXXFLAGS
|
||||
CMAKE_NO_EXPLICIT_TEMPLATE_INSTANTIATION
|
||||
CMAKE_MAKE_PROGRAM
|
||||
)
|
||||
|
|
|
@ -15,4 +15,16 @@ SET (CMAKE_CXX_FLAGS_DEBUG "/MDd /Zi /Od /GZ" CACHE STRING
|
|||
SET (CMAKE_CXX_FLAGS "/W3 /Zm1000 /GX /GR" CACHE STRING
|
||||
"Flags used by the compiler during all build types, /GX /GR are for exceptions and rtti in VC++, /Zm1000 increases the compiler's memory allocation to support ANSI C++/stdlib")
|
||||
SET (CMAKE_USE_WIN32_THREADS 1 CACHE BOOL "Use the win32 thread library")
|
||||
SET (CMAKE_MAKE_PROGRAM "msdev" CACHE STRING "Program used to build from dsp files.")
|
||||
SET (CMAKE_MAKE_PROGRAM "msdev" CACHE STRING "Program used to build from dsp files.")
|
||||
MARK_AS_ADVANCED(
|
||||
WORDS_BIGENDIAN
|
||||
HAVE_UNISTD_H
|
||||
HAVE_LIMITS_H
|
||||
CMAKE_CXX_COMPILER
|
||||
CMAKE_CXX_FLAGS_RELEASE
|
||||
CMAKE_CXX_FLAGS_RELWITHDEBINFO
|
||||
CMAKE_CXX_FLAGS_MINSIZEREL
|
||||
CMAKE_CXX_FLAGS_DEBUG
|
||||
CMAKE_USE_WIN32_THREADS
|
||||
CMAKE_MAKE_PROGRAM
|
||||
)
|
Loading…
Reference in New Issue