From 3125c47d27d4d57cb31e10c4bd658fc1e352299d Mon Sep 17 00:00:00 2001 From: Regina Pfeifer Date: Tue, 20 Nov 2018 13:50:19 +0100 Subject: 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 --- Help/command/ctest_build.rst | 4 +--- Source/CTest/cmCTestBuildCommand.cxx | 16 ++-------------- 2 files changed, 3 insertions(+), 17 deletions(-) diff --git a/Help/command/ctest_build.rst b/Help/command/ctest_build.rst index 55bb4a3..66e1844 100644 --- a/Help/command/ctest_build.rst +++ b/Help/command/ctest_build.rst @@ -50,9 +50,7 @@ The options are: for an example. ``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 `` Specify the name of a target to build. If not specified the diff --git a/Source/CTest/cmCTestBuildCommand.cxx b/Source/CTest/cmCTestBuildCommand.cxx index ce27da1..65b4976 100644 --- a/Source/CTest/cmCTestBuildCommand.cxx +++ b/Source/CTest/cmCTestBuildCommand.cxx @@ -53,10 +53,6 @@ cmCTestGenericHandler* cmCTestBuildCommand::InitializeHandler() } else { const char* cmakeGeneratorName = 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, // or CTEST_BUILD_CONFIGURATION script variable, or @@ -81,8 +77,7 @@ cmCTestGenericHandler* cmCTestBuildCommand::InitializeHandler() ? this->Values[ctb_TARGET] : this->Makefile->GetDefinition("CTEST_BUILD_TARGET"); - if (cmakeGeneratorName && *cmakeGeneratorName && cmakeProjectName && - *cmakeProjectName) { + if (cmakeGeneratorName && *cmakeGeneratorName) { if (!cmakeBuildConfiguration) { cmakeBuildConfiguration = "Release"; } @@ -132,14 +127,7 @@ cmCTestGenericHandler* cmCTestBuildCommand::InitializeHandler() /* clang-format off */ ostr << "has no project to build. If this is a " "\"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."; /* clang-format on */ this->SetError(ostr.str()); -- cgit v0.12