diff --git a/Help/policy/CMP0036.rst b/Help/policy/CMP0036.rst index 4bcfc54d94..0d1f857d7a 100644 --- a/Help/policy/CMP0036.rst +++ b/Help/policy/CMP0036.rst @@ -1,6 +1,9 @@ CMP0036 ------- +.. |REMOVED_IN_CMAKE_VERSION| replace:: 4.0 +.. include:: REMOVED_PROLOGUE.txt + The :command:`build_name` command should not be called. This command was added in May 2001 to compute a name for the current @@ -9,6 +12,4 @@ documented as discouraged and replaced by the :variable:`CMAKE_SYSTEM` and :variable:`CMAKE__COMPILER` variables. .. |disallowed_version| replace:: 3.0 -.. include:: DISALLOWED_COMMAND.txt - -.. include:: DEPRECATED.txt +.. include:: REMOVED_COMMAND.txt diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt index 79706c6b48..373e695337 100644 --- a/Source/CMakeLists.txt +++ b/Source/CMakeLists.txt @@ -548,8 +548,6 @@ add_library( cmBreakCommand.h cmBuildCommand.cxx cmBuildCommand.h - cmBuildNameCommand.cxx - cmBuildNameCommand.h cmCMakeHostSystemInformationCommand.cxx cmCMakeHostSystemInformationCommand.h cmCMakeLanguageCommand.cxx diff --git a/Source/cmBuildNameCommand.cxx b/Source/cmBuildNameCommand.cxx deleted file mode 100644 index 20d6089b9f..0000000000 --- a/Source/cmBuildNameCommand.cxx +++ /dev/null @@ -1,61 +0,0 @@ -/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying - file Copyright.txt or https://cmake.org/licensing for details. */ -#include "cmBuildNameCommand.h" - -#include - -#include "cmsys/RegularExpression.hxx" - -#include "cmExecutionStatus.h" -#include "cmMakefile.h" -#include "cmStateTypes.h" -#include "cmSystemTools.h" -#include "cmValue.h" - -bool cmBuildNameCommand(std::vector const& args, - cmExecutionStatus& status) -{ - if (args.empty()) { - status.SetError("called with incorrect number of arguments"); - return false; - } - cmMakefile& mf = status.GetMakefile(); - cmValue cacheValue = mf.GetDefinition(args[0]); - if (cacheValue) { - // do we need to correct the value? - cmsys::RegularExpression reg("[()/]"); - std::string cv = *cacheValue; - if (reg.find(cv)) { - std::replace(cv.begin(), cv.end(), '/', '_'); - std::replace(cv.begin(), cv.end(), '(', '_'); - std::replace(cv.begin(), cv.end(), ')', '_'); - mf.AddCacheDefinition(args[0], cv, "Name of build.", - cmStateEnums::STRING); - } - return true; - } - - std::string buildname = "WinNT"; - if (mf.GetDefinition("UNIX")) { - buildname.clear(); - cmSystemTools::RunSingleCommand("uname -a", &buildname, &buildname); - if (!buildname.empty()) { - std::string RegExp = "([^ ]*) [^ ]* ([^ ]*) "; - cmsys::RegularExpression reg(RegExp); - if (reg.find(buildname)) { - buildname = reg.match(1) + "-" + reg.match(2); - } - } - } - std::string compiler = "${CMAKE_CXX_COMPILER}"; - mf.ExpandVariablesInString(compiler); - buildname += "-"; - buildname += cmSystemTools::GetFilenameName(compiler); - std::replace(buildname.begin(), buildname.end(), '/', '_'); - std::replace(buildname.begin(), buildname.end(), '(', '_'); - std::replace(buildname.begin(), buildname.end(), ')', '_'); - - mf.AddCacheDefinition(args[0], buildname, "Name of build.", - cmStateEnums::STRING); - return true; -} diff --git a/Source/cmBuildNameCommand.h b/Source/cmBuildNameCommand.h deleted file mode 100644 index 650dc74ff8..0000000000 --- a/Source/cmBuildNameCommand.h +++ /dev/null @@ -1,13 +0,0 @@ -/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying - file Copyright.txt or https://cmake.org/licensing for details. */ -#pragma once - -#include "cmConfigure.h" // IWYU pragma: keep - -#include -#include - -class cmExecutionStatus; - -bool cmBuildNameCommand(std::vector const& args, - cmExecutionStatus& status); diff --git a/Source/cmCommands.cxx b/Source/cmCommands.cxx index b0d38ab059..f4852faf9c 100644 --- a/Source/cmCommands.cxx +++ b/Source/cmCommands.cxx @@ -93,7 +93,6 @@ # include "cmAddCompileOptionsCommand.h" # include "cmAddLinkOptionsCommand.h" # include "cmAuxSourceDirectoryCommand.h" -# include "cmBuildNameCommand.h" # include "cmCMakeHostSystemInformationCommand.h" # include "cmCMakePkgConfigCommand.h" # include "cmExportCommand.h" @@ -209,9 +208,8 @@ void GetScriptingCommands(cmState* state) state->AddBuiltinCommand("variable_watch", cmVariableWatchCommand); state->AddBuiltinCommand("write_file", cmWriteFileCommand); - state->AddDisallowedCommand( - "build_name", cmBuildNameCommand, cmPolicies::CMP0036, - "The build_name command should not be called; see CMP0036."); + state->AddRemovedCommand( + "build_name", "The build_name command has been removed; see CMP0036."); state->AddRemovedCommand( "use_mangled_mesa", "The use_mangled_mesa command has been removed; see CMP0030."); diff --git a/Source/cmPolicies.h b/Source/cmPolicies.h index 736364ade6..c3f8aa27c8 100644 --- a/Source/cmPolicies.h +++ b/Source/cmPolicies.h @@ -113,7 +113,7 @@ class cmMakefile; SELECT(POLICY, CMP0035, \ "The variable_requires command should not be called.", 3, 0, 0, NEW) \ SELECT(POLICY, CMP0036, "The build_name command should not be called.", 3, \ - 0, 0, WARN) \ + 0, 0, NEW) \ SELECT(POLICY, CMP0037, \ "Target names should not be reserved and should match a validity " \ "pattern.", \ diff --git a/Tests/RunCMake/DisallowedCommands/CMP0036-NEW-stderr.txt b/Tests/RunCMake/DisallowedCommands/CMP0036-NEW-stderr.txt index 11aabd0980..f5e3f02304 100644 --- a/Tests/RunCMake/DisallowedCommands/CMP0036-NEW-stderr.txt +++ b/Tests/RunCMake/DisallowedCommands/CMP0036-NEW-stderr.txt @@ -1,4 +1,4 @@ -CMake Error at CMP0036-NEW.cmake:2 \(build_name\): - The build_name command should not be called; see CMP0036. +CMake Error at CMP0036-NEW.cmake:1 \(build_name\): + The build_name command has been removed; see CMP0036. Call Stack \(most recent call first\): CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/DisallowedCommands/CMP0036-NEW.cmake b/Tests/RunCMake/DisallowedCommands/CMP0036-NEW.cmake index 5341db2a06..9556687ab8 100644 --- a/Tests/RunCMake/DisallowedCommands/CMP0036-NEW.cmake +++ b/Tests/RunCMake/DisallowedCommands/CMP0036-NEW.cmake @@ -1,2 +1 @@ -cmake_policy(SET CMP0036 NEW) build_name() diff --git a/Tests/RunCMake/DisallowedCommands/CMP0036-OLD-result.txt b/Tests/RunCMake/DisallowedCommands/CMP0036-OLD-result.txt deleted file mode 100644 index d00491fd7e..0000000000 --- a/Tests/RunCMake/DisallowedCommands/CMP0036-OLD-result.txt +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/Tests/RunCMake/DisallowedCommands/CMP0036-OLD-stderr.txt b/Tests/RunCMake/DisallowedCommands/CMP0036-OLD-stderr.txt deleted file mode 100644 index fef195f405..0000000000 --- a/Tests/RunCMake/DisallowedCommands/CMP0036-OLD-stderr.txt +++ /dev/null @@ -1,4 +0,0 @@ -CMake Error at CMP0036-OLD.cmake:2 \(build_name\): - build_name called with incorrect number of arguments -Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/DisallowedCommands/CMP0036-OLD.cmake b/Tests/RunCMake/DisallowedCommands/CMP0036-OLD.cmake deleted file mode 100644 index fdd840f940..0000000000 --- a/Tests/RunCMake/DisallowedCommands/CMP0036-OLD.cmake +++ /dev/null @@ -1,2 +0,0 @@ -cmake_policy(SET CMP0036 OLD) -build_name() diff --git a/Tests/RunCMake/DisallowedCommands/CMP0036-WARN-result.txt b/Tests/RunCMake/DisallowedCommands/CMP0036-WARN-result.txt deleted file mode 100644 index d00491fd7e..0000000000 --- a/Tests/RunCMake/DisallowedCommands/CMP0036-WARN-result.txt +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/Tests/RunCMake/DisallowedCommands/CMP0036-WARN-stderr.txt b/Tests/RunCMake/DisallowedCommands/CMP0036-WARN-stderr.txt deleted file mode 100644 index b9b7c5a9ce..0000000000 --- a/Tests/RunCMake/DisallowedCommands/CMP0036-WARN-stderr.txt +++ /dev/null @@ -1,12 +0,0 @@ -CMake Warning \(dev\) at CMP0036-WARN.cmake:1 \(build_name\): - Policy CMP0036 is not set: The build_name command should not be called. - Run "cmake --help-policy CMP0036" for policy details. Use the cmake_policy - command to set the policy and suppress this warning. -Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\) -This warning is for project developers. Use -Wno-dev to suppress it. - -CMake Error at CMP0036-WARN.cmake:1 \(build_name\): - build_name called with incorrect number of arguments -Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/DisallowedCommands/CMP0036-WARN.cmake b/Tests/RunCMake/DisallowedCommands/CMP0036-WARN.cmake deleted file mode 100644 index 9556687ab8..0000000000 --- a/Tests/RunCMake/DisallowedCommands/CMP0036-WARN.cmake +++ /dev/null @@ -1 +0,0 @@ -build_name() diff --git a/Tests/RunCMake/DisallowedCommands/RunCMakeTest.cmake b/Tests/RunCMake/DisallowedCommands/RunCMakeTest.cmake index a526f6e190..c65bbd43dd 100644 --- a/Tests/RunCMake/DisallowedCommands/RunCMakeTest.cmake +++ b/Tests/RunCMake/DisallowedCommands/RunCMakeTest.cmake @@ -8,16 +8,7 @@ foreach(p CMP0033 CMP0034 CMP0035 - ) - run_cmake(${p}-NEW) -endforeach() - -return() - -foreach(p CMP0036 ) - run_cmake(${p}-WARN) - run_cmake(${p}-OLD) run_cmake(${p}-NEW) endforeach() diff --git a/Tests/Testing/CMakeLists.txt b/Tests/Testing/CMakeLists.txt index 45ee8587fa..e9c1c1a38d 100644 --- a/Tests/Testing/CMakeLists.txt +++ b/Tests/Testing/CMakeLists.txt @@ -30,10 +30,6 @@ endif () # Extra coverage # build_command(BUILD_COMMAND_VAR ${CMAKE_MAKE_PROGRAM}) -block(SCOPE_FOR POLICIES) -cmake_policy(VERSION 2.8.12) # old enough to not set CMP0036 -build_name(BUILD_NAME_VAR) -endblock() site_name(SITE_NAME_VAR) #