summaryrefslogtreecommitdiffstats
path: root/Source/cmGlobalUnixMakefileGenerator3.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2013-11-12 13:44:08 (GMT)
committerBrad King <brad.king@kitware.com>2013-11-12 13:47:19 (GMT)
commit684063c0363687285126f30a517239aa2ad46149 (patch)
treec7bb4a0540da44dc14d1b8ab5de4b0102d925dd2 /Source/cmGlobalUnixMakefileGenerator3.cxx
parenteaf5b7a776e24af55f6f7f254171c3e2d2932d9b (diff)
downloadCMake-684063c0363687285126f30a517239aa2ad46149.zip
CMake-684063c0363687285126f30a517239aa2ad46149.tar.gz
CMake-684063c0363687285126f30a517239aa2ad46149.tar.bz2
Refactor tool selection for edit_cache (#14544)
Refactor edit_cache tool selection to ask each global generator for its preference. Teach the Ninja generator to always use cmake-gui because Ninja by design cannot run interactive terminal dialogs like ccmake. Teach the Makefile generator to use cmake-gui when also using an "extra" generator whose IDE has no terminal to run ccmake, and otherwise fall back to CMAKE_EDIT_COMMAND selection for normal Makefile build systems.
Diffstat (limited to 'Source/cmGlobalUnixMakefileGenerator3.cxx')
-rw-r--r--Source/cmGlobalUnixMakefileGenerator3.cxx44
1 files changed, 44 insertions, 0 deletions
diff --git a/Source/cmGlobalUnixMakefileGenerator3.cxx b/Source/cmGlobalUnixMakefileGenerator3.cxx
index ce95c08..cfd93c2 100644
--- a/Source/cmGlobalUnixMakefileGenerator3.cxx
+++ b/Source/cmGlobalUnixMakefileGenerator3.cxx
@@ -68,6 +68,42 @@ void cmGlobalUnixMakefileGenerator3
}
//----------------------------------------------------------------------------
+std::string cmGlobalUnixMakefileGenerator3::GetEditCacheCommand() const
+{
+ // If generating for an extra IDE, the edit_cache target cannot
+ // launch a terminal-interactive tool, so always use cmake-gui.
+ if(this->GetExtraGeneratorName())
+ {
+ return cmSystemTools::GetCMakeGUICommand();
+ }
+
+ // Use an internal cache entry to track the latest dialog used
+ // to edit the cache, and use that for the edit_cache target.
+ cmake* cm = this->GetCMakeInstance();
+ std::string editCacheCommand = cm->GetCMakeEditCommand();
+ if(!cm->GetCacheDefinition("CMAKE_EDIT_COMMAND") ||
+ !editCacheCommand.empty())
+ {
+ if(editCacheCommand.empty())
+ {
+ editCacheCommand = cmSystemTools::GetCMakeCursesCommand();
+ }
+ if(editCacheCommand.empty())
+ {
+ editCacheCommand = cmSystemTools::GetCMakeGUICommand();
+ }
+ if(!editCacheCommand.empty())
+ {
+ cm->AddCacheEntry
+ ("CMAKE_EDIT_COMMAND", editCacheCommand.c_str(),
+ "Path to cache edit program executable.", cmCacheManager::INTERNAL);
+ }
+ }
+ const char* edit_cmd = cm->GetCacheDefinition("CMAKE_EDIT_COMMAND");
+ return edit_cmd? edit_cmd : "";
+}
+
+//----------------------------------------------------------------------------
void
cmGlobalUnixMakefileGenerator3
::ComputeTargetObjects(cmGeneratorTarget* gt) const
@@ -99,6 +135,14 @@ cmGlobalUnixMakefileGenerator3
}
}
+void cmGlobalUnixMakefileGenerator3::Configure()
+{
+ // Initialize CMAKE_EDIT_COMMAND cache entry.
+ this->GetEditCacheCommand();
+
+ this->cmGlobalGenerator::Configure();
+}
+
void cmGlobalUnixMakefileGenerator3::Generate()
{
// first do superclass method