From 30f17e293261ec9e667b75b13fa1b70060a9cc7b Mon Sep 17 00:00:00 2001 From: Brad King Date: Thu, 10 Dec 2009 09:10:12 -0500 Subject: [PATCH] Fix installation of CMake itself CMake 2.8.0 and below use the EXECUTABLE_OUTPUT_PATH setting from the top-level CMakeLists.txt file to compute the location of the "cmake" target for the special case of installing cmake over itself. The commit "Clean up CMake build tree 'bin' directory" moved the setting of EXECUTABLE_OUTPUT_PATH that affects the "cmake" target into the Source subdirectory. This broke the special-case lookup in the top level. We fix it by setting EXECUTABLE_OUTPUT_PATH at the end of the top-level CMakeLists.txt file. Now that we use add_subdirectory to process the subdirectories in order, this setting does not affect the subdirectories. Thus we fix installation while preserving the clean build tree 'bin' directory intended by the above-mentioned commit. --- CMakeLists.txt | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 4fc788a65..173e92314 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -476,3 +476,10 @@ INSTALL( #----------------------------------------------------------------------- # End of the main section of the CMakeLists file #----------------------------------------------------------------------- + +# As a special case when building CMake itself, CMake 2.8.0 and below +# look up EXECUTABLE_OUTPUT_PATH in the top-level CMakeLists.txt file +# to compute the location of the "cmake" executable. We set it here +# so that those CMake versions can find it. We wait until after all +# the add_subdirectory() calls to avoid affecting the subdirectories. +SET(EXECUTABLE_OUTPUT_PATH ${CMake_BIN_DIR})