diff options
author | Bill Hoffman <bill.hoffman@kitware.com> | 2008-02-12 14:49:42 (GMT) |
---|---|---|
committer | Bill Hoffman <bill.hoffman@kitware.com> | 2008-02-12 14:49:42 (GMT) |
commit | 3fa087c8ab7bb6d1aa1c6a1edc32edd66e781bb8 (patch) | |
tree | f32e5b7a4fda680667ac13c1c9a76e2c0836dcee /Source/cmake.cxx | |
parent | 88eca37d4ef804efc7d6cc204cf96ca07abd8482 (diff) | |
download | CMake-3fa087c8ab7bb6d1aa1c6a1edc32edd66e781bb8.zip CMake-3fa087c8ab7bb6d1aa1c6a1edc32edd66e781bb8.tar.gz CMake-3fa087c8ab7bb6d1aa1c6a1edc32edd66e781bb8.tar.bz2 |
ENH: fix make edit_cache for cmake-gui
Diffstat (limited to 'Source/cmake.cxx')
-rw-r--r-- | Source/cmake.cxx | 45 |
1 files changed, 32 insertions, 13 deletions
diff --git a/Source/cmake.cxx b/Source/cmake.cxx index 8f36aab..cf89a4c 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -756,20 +756,39 @@ int cmake::AddCMakePaths() this->CacheManager->AddCacheEntry ("CMAKE_COMMAND",cMakeSelf.c_str(), "Path to CMake executable.", cmCacheManager::INTERNAL); - - // Find and save the command to edit the cache - std::string editCacheCommand = cmSystemTools::GetFilenamePath(cMakeSelf) + - "/ccmake" + cmSystemTools::GetFilenameExtension(cMakeSelf); - if( !cmSystemTools::FileExists(editCacheCommand.c_str())) - { - editCacheCommand = cmSystemTools::GetFilenamePath(cMakeSelf) + - "/CMakeSetup" + cmSystemTools::GetFilenameExtension(cMakeSelf); - } - if(cmSystemTools::FileExists(editCacheCommand.c_str())) + // if the edit command is not yet in the cache, + // or if CMakeEditCommand has been set on this object, + // then set the CMAKE_EDIT_COMMAND in the cache + // This will mean that the last gui to edit the cache + // will be the one that make edit_cache uses. + if(!this->GetCacheDefinition("CMAKE_EDIT_COMMAND") + || !this->CMakeEditCommand.empty()) { - this->CacheManager->AddCacheEntry - ("CMAKE_EDIT_COMMAND", editCacheCommand.c_str(), - "Path to cache edit program executable.", cmCacheManager::INTERNAL); + // Find and save the command to edit the cache + std::string editCacheCommand; + if(!this->CMakeEditCommand.empty()) + { + editCacheCommand = cmSystemTools::GetFilenamePath(cMakeSelf) + + std::string("/") + + this->CMakeEditCommand + + cmSystemTools::GetFilenameExtension(cMakeSelf); + } + if( !cmSystemTools::FileExists(editCacheCommand.c_str())) + { + editCacheCommand = cmSystemTools::GetFilenamePath(cMakeSelf) + + "/ccmake" + cmSystemTools::GetFilenameExtension(cMakeSelf); + } + if( !cmSystemTools::FileExists(editCacheCommand.c_str())) + { + editCacheCommand = cmSystemTools::GetFilenamePath(cMakeSelf) + + "/CMakeSetup" + cmSystemTools::GetFilenameExtension(cMakeSelf); + } + if(cmSystemTools::FileExists(editCacheCommand.c_str())) + { + this->CacheManager->AddCacheEntry + ("CMAKE_EDIT_COMMAND", editCacheCommand.c_str(), + "Path to cache edit program executable.", cmCacheManager::INTERNAL); + } } std::string ctestCommand = cmSystemTools::GetFilenamePath(cMakeSelf) + "/ctest" + cmSystemTools::GetFilenameExtension(cMakeSelf); |