summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBill Hoffman <bill.hoffman@kitware.com>2001-06-21 20:34:13 (GMT)
committerBill Hoffman <bill.hoffman@kitware.com>2001-06-21 20:34:13 (GMT)
commita2b757aa2d6addbdbbaebaa2054e6998b1632534 (patch)
treeec1eb352368b78c8c9ea1de87a995a997e6224d9
parent3a200bf9093462109038ed6664001dd4b1b33e06 (diff)
downloadCMake-a2b757aa2d6addbdbbaebaa2054e6998b1632534.zip
CMake-a2b757aa2d6addbdbbaebaa2054e6998b1632534.tar.gz
CMake-a2b757aa2d6addbdbbaebaa2054e6998b1632534.tar.bz2
ENH: better ability to find cmake program
-rw-r--r--Source/cmConfigure.cmake.h.in3
-rw-r--r--Source/cmake.cxx20
2 files changed, 22 insertions, 1 deletions
diff --git a/Source/cmConfigure.cmake.h.in b/Source/cmConfigure.cmake.h.in
index 6d76a5c..79cd673 100644
--- a/Source/cmConfigure.cmake.h.in
+++ b/Source/cmConfigure.cmake.h.in
@@ -1,5 +1,8 @@
#cmakedefine CMAKE_NO_STD_NAMESPACE
#cmakedefine CMAKE_NO_ANSI_STREAM_HEADERS
#define CMAKE_ROOT_DIR "${CMake_SOURCE_DIR}"
+#define CMAKE_BUILD_DIR "${CMake_BINARY_DIR}"
+#define CMAKE_PREFIX "${CMAKE_INSTALL_PREFIX}"
+
diff --git a/Source/cmake.cxx b/Source/cmake.cxx
index f015024..f7b21b5 100644
--- a/Source/cmake.cxx
+++ b/Source/cmake.cxx
@@ -133,7 +133,25 @@ void cmake::AddCMakePaths(const std::vector<std::string>& args)
std::string cMakeSelf = args[0];
cmSystemTools::ConvertToUnixSlashes(cMakeSelf);
cMakeSelf = cmSystemTools::FindProgram(cMakeSelf.c_str());
-
+#ifdef CMAKE_BUILD_DIR
+ if(!cmSystemTools::FileExists(cMakeSelf.c_str()))
+ {
+ cMakeSelf = CMAKE_BUILD_DIR;
+ cMakeSelf += "/Source/cmake";
+ }
+#endif
+#ifdef CMAKE_PREFIX
+ if(!cmSystemTools::FileExists(cMakeSelf.c_str()))
+ {
+ cMakeSelf = CMAKE_PREFIX "/bin/cmake";
+ }
+#endif
+ if(!cmSystemTools::FileExists(cMakeSelf.c_str()))
+ {
+ cmSystemTools::Error("CMAKE can not find the command line program cmake. "
+ "Attempted path: ", cMakeSelf.c_str());
+ return;
+ }
// Save the value in the cache
cmCacheManager::GetInstance()->AddCacheEntry
("CMAKE_COMMAND",