瀏覽代碼

ctest_build: Do not require unnecessary [CTEST_]PROJECT_NAME value

Since commit v3.0.0-rc1~260^2~32 (ctest_build: Use "cmake --build"
to launch the native build tool, 2013-11-14) we no longer need to
use the project name in `ctest_build()`.

Fixes: #18612
Regina Pfeifer 7 年之前
父節點
當前提交
3125c47d27
共有 2 個文件被更改,包括 3 次插入17 次删除
  1. 1 3
      Help/command/ctest_build.rst
  2. 2 14
      Source/CTest/cmCTestBuildCommand.cxx

+ 1 - 3
Help/command/ctest_build.rst

@@ -50,9 +50,7 @@ The options are:
   for an example.
   for an example.
 
 
 ``PROJECT_NAME <project-name>``
 ``PROJECT_NAME <project-name>``
-  Set the name of the project to build.  This should correspond
-  to the top-level call to the :command:`project` command.
-  If not specified the ``CTEST_PROJECT_NAME`` variable will be checked.
+  Ignored.  This was once used but is no longer needed.
 
 
 ``TARGET <target-name>``
 ``TARGET <target-name>``
   Specify the name of a target to build.  If not specified the
   Specify the name of a target to build.  If not specified the

+ 2 - 14
Source/CTest/cmCTestBuildCommand.cxx

@@ -53,10 +53,6 @@ cmCTestGenericHandler* cmCTestBuildCommand::InitializeHandler()
   } else {
   } else {
     const char* cmakeGeneratorName =
     const char* cmakeGeneratorName =
       this->Makefile->GetDefinition("CTEST_CMAKE_GENERATOR");
       this->Makefile->GetDefinition("CTEST_CMAKE_GENERATOR");
-    const char* cmakeProjectName =
-      (this->Values[ctb_PROJECT_NAME] && *this->Values[ctb_PROJECT_NAME])
-      ? this->Values[ctb_PROJECT_NAME]
-      : this->Makefile->GetDefinition("CTEST_PROJECT_NAME");
 
 
     // Build configuration is determined by: CONFIGURATION argument,
     // Build configuration is determined by: CONFIGURATION argument,
     // or CTEST_BUILD_CONFIGURATION script variable, or
     // or CTEST_BUILD_CONFIGURATION script variable, or
@@ -81,8 +77,7 @@ cmCTestGenericHandler* cmCTestBuildCommand::InitializeHandler()
       ? this->Values[ctb_TARGET]
       ? this->Values[ctb_TARGET]
       : this->Makefile->GetDefinition("CTEST_BUILD_TARGET");
       : this->Makefile->GetDefinition("CTEST_BUILD_TARGET");
 
 
-    if (cmakeGeneratorName && *cmakeGeneratorName && cmakeProjectName &&
-        *cmakeProjectName) {
+    if (cmakeGeneratorName && *cmakeGeneratorName) {
       if (!cmakeBuildConfiguration) {
       if (!cmakeBuildConfiguration) {
         cmakeBuildConfiguration = "Release";
         cmakeBuildConfiguration = "Release";
       }
       }
@@ -132,14 +127,7 @@ cmCTestGenericHandler* cmCTestBuildCommand::InitializeHandler()
       /* clang-format off */
       /* clang-format off */
       ostr << "has no project to build. If this is a "
       ostr << "has no project to build. If this is a "
         "\"built with CMake\" project, verify that CTEST_CMAKE_GENERATOR "
         "\"built with CMake\" project, verify that CTEST_CMAKE_GENERATOR "
-        "and CTEST_PROJECT_NAME are set."
-        "\n"
-        "CTEST_PROJECT_NAME is usually set in CTestConfig.cmake. Verify "
-        "that CTestConfig.cmake exists, or CTEST_PROJECT_NAME "
-        "is set in the script, or PROJECT_NAME is passed as an argument "
-        "to ctest_build."
-        "\n"
-        "Alternatively, set CTEST_BUILD_COMMAND to build the project "
+        "is set. Otherwise, set CTEST_BUILD_COMMAND to build the project "
         "with a custom command line.";
         "with a custom command line.";
       /* clang-format on */
       /* clang-format on */
       this->SetError(ostr.str());
       this->SetError(ostr.str());