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.
This commit is contained in:
Brad King 2009-12-10 09:09:50 -05:00
parent 419d050bb5
commit d5eb99cb6f
1 changed files with 4 additions and 13 deletions

View File

@ -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] != '.' )