mirror of
https://github.com/Kitware/CMake.git
synced 2026-05-03 12:49:50 -05:00
CMP0036: Remove support for OLD build_name command
This commit is contained in:
@@ -548,8 +548,6 @@ add_library(
|
||||
cmBreakCommand.h
|
||||
cmBuildCommand.cxx
|
||||
cmBuildCommand.h
|
||||
cmBuildNameCommand.cxx
|
||||
cmBuildNameCommand.h
|
||||
cmCMakeHostSystemInformationCommand.cxx
|
||||
cmCMakeHostSystemInformationCommand.h
|
||||
cmCMakeLanguageCommand.cxx
|
||||
|
||||
@@ -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 <algorithm>
|
||||
|
||||
#include "cmsys/RegularExpression.hxx"
|
||||
|
||||
#include "cmExecutionStatus.h"
|
||||
#include "cmMakefile.h"
|
||||
#include "cmStateTypes.h"
|
||||
#include "cmSystemTools.h"
|
||||
#include "cmValue.h"
|
||||
|
||||
bool cmBuildNameCommand(std::vector<std::string> 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;
|
||||
}
|
||||
@@ -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 <string>
|
||||
#include <vector>
|
||||
|
||||
class cmExecutionStatus;
|
||||
|
||||
bool cmBuildNameCommand(std::vector<std::string> const& args,
|
||||
cmExecutionStatus& status);
|
||||
@@ -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.");
|
||||
|
||||
+1
-1
@@ -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.", \
|
||||
|
||||
Reference in New Issue
Block a user