浏览代码

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.
Brad King 16 年之前
父节点
当前提交
d5eb99cb6f
共有 1 个文件被更改,包括 4 次插入13 次删除
  1. 4 13
      Source/cmGlobalGenerator.cxx

+ 4 - 13
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] != '.' )