diff options
author | David Cole <david.cole@kitware.com> | 2010-11-09 20:32:43 (GMT) |
---|---|---|
committer | CMake Topic Stage <kwrobot@kitware.com> | 2010-11-09 20:32:43 (GMT) |
commit | 1774622487bde44967d6c3181780e6705acf1b9d (patch) | |
tree | 7e4e84dfc1d1b95448649179d241fdaf6c7e4f70 /Source/QtDialog | |
parent | 9692d5a2b6f706f8b3cfd31fcb5b47277961ccab (diff) | |
parent | 0476715b87e27c8234bc6c3ac9020cb09ac8be1b (diff) | |
download | CMake-1774622487bde44967d6c3181780e6705acf1b9d.zip CMake-1774622487bde44967d6c3181780e6705acf1b9d.tar.gz CMake-1774622487bde44967d6c3181780e6705acf1b9d.tar.bz2 |
Merge topic 'cmake-gui-args-11388'
0476715 Fix regression to allow specifying a CMakeCache.txt file on the command line.
Diffstat (limited to 'Source/QtDialog')
-rw-r--r-- | Source/QtDialog/CMakeSetup.cxx | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/Source/QtDialog/CMakeSetup.cxx b/Source/QtDialog/CMakeSetup.cxx index 28f4697..7ba7f51 100644 --- a/Source/QtDialog/CMakeSetup.cxx +++ b/Source/QtDialog/CMakeSetup.cxx @@ -165,13 +165,25 @@ int main(int argc, char** argv) if(args.count() == 2) { cmsys_stl::string filePath = cmSystemTools::CollapseFullPath(args[1].toAscii().data()); + + // check if argument is a directory containing CMakeCache.txt cmsys_stl::string buildFilePath = cmSystemTools::CollapseFullPath("CMakeCache.txt", filePath.c_str()); + + // check if argument is a CMakeCache.txt file + if(cmSystemTools::GetFilenameName(filePath) == "CMakeCache.txt" && + cmSystemTools::FileExists(filePath.c_str())) + { + buildFilePath = filePath; + } + + // check if argument is a directory containing CMakeLists.txt cmsys_stl::string srcFilePath = cmSystemTools::CollapseFullPath("CMakeLists.txt", filePath.c_str()); + if(cmSystemTools::FileExists(buildFilePath.c_str())) { - dialog.setBinaryDirectory(filePath.c_str()); + dialog.setBinaryDirectory(cmSystemTools::GetFilenamePath(buildFilePath).c_str()); } else if(cmSystemTools::FileExists(srcFilePath.c_str())) { |