From d5eb99cb6ff0313626ce376522fcd0fceaeddd18 Mon Sep 17 00:00:00 2001 From: Brad King <brad.king@kitware.com> Date: Thu, 10 Dec 2009 09:09:50 -0500 Subject: Simplify CMake self-install special case CMake has a special case for the "make install" target when building CMake itself. We use the just-built CMake to install itself since an existing CMake installation cannot replace itself (at least on Windows). We simplify the code that computes the location of the CMake binary by taking advantage of existing generator support for target lookup. This will make it robust to any changes in CMake's own CMakeLists.txt files in the future. --- Source/cmGlobalGenerator.cxx | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index 4734c50..1cbd423 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -1761,7 +1761,7 @@ void cmGlobalGenerator::CreateDefaultGlobalTargets(cmTargets* targets) ostr.str().c_str(), &cpackCommandLines, depends, 0); } - std::string cmd; + std::string cmd = cmakeCommand; cpackCommandLines.erase(cpackCommandLines.begin(), cpackCommandLines.end()); singleLine.erase(singleLine.begin(), singleLine.end()); @@ -1782,18 +1782,9 @@ void cmGlobalGenerator::CreateDefaultGlobalTargets(cmTargets* targets) if(mf->GetDefinition("CMake_BINARY_DIR")) { // We are building CMake itself. We cannot use the original - // executable to install over itself. - cmd = mf->GetDefinition("EXECUTABLE_OUTPUT_PATH"); - if(cmakeCfgIntDir && *cmakeCfgIntDir && cmakeCfgIntDir[0] != '.') - { - cmd += "/"; - cmd += cmakeCfgIntDir; - } - cmd += "/cmake"; - } - else - { - cmd = cmakeCommand; + // executable to install over itself. The generator will + // automatically convert this name to the build-time location. + cmd = "cmake"; } singleLine.push_back(cmd.c_str()); if ( cmakeCfgIntDir && *cmakeCfgIntDir && cmakeCfgIntDir[0] != '.' ) -- cgit v0.12