Просмотр исходного кода

CMP0030: Remove support for OLD use_mangled_mesa command

Brad King 1 год назад
Родитель
Сommit
6bdf4efbb3

+ 4 - 3
Help/policy/CMP0030.rst

@@ -1,6 +1,9 @@
 CMP0030
 -------
 
+.. |REMOVED_IN_CMAKE_VERSION| replace:: 4.0
+.. include:: REMOVED_PROLOGUE.txt
+
 The :command:`use_mangled_mesa` command should not be called.
 
 This command was created in September 2001 to support VTK before
@@ -8,6 +11,4 @@ modern CMake language and custom command capabilities.  VTK has
 not used it in years.
 
 .. |disallowed_version| replace:: 3.0
-.. include:: DISALLOWED_COMMAND.txt
-
-.. include:: DEPRECATED.txt
+.. include:: REMOVED_COMMAND.txt

+ 0 - 2
Source/CMakeLists.txt

@@ -758,8 +758,6 @@ add_library(
   cmTryRunCommand.h
   cmUnsetCommand.cxx
   cmUnsetCommand.h
-  cmUseMangledMesaCommand.cxx
-  cmUseMangledMesaCommand.h
   cmUtilitySourceCommand.cxx
   cmUtilitySourceCommand.h
   cmVariableRequiresCommand.cxx

+ 3 - 4
Source/cmCommands.cxx

@@ -112,7 +112,6 @@
 #  include "cmRemoveDefinitionsCommand.h"
 #  include "cmSourceGroupCommand.h"
 #  include "cmTargetLinkDirectoriesCommand.h"
-#  include "cmUseMangledMesaCommand.h"
 #  include "cmUtilitySourceCommand.h"
 #  include "cmVariableRequiresCommand.h"
 #  include "cmVariableWatchCommand.h"
@@ -218,9 +217,9 @@ void GetScriptingCommands(cmState* state)
   state->AddDisallowedCommand(
     "build_name", cmBuildNameCommand, cmPolicies::CMP0036,
     "The build_name command should not be called; see CMP0036.");
-  state->AddDisallowedCommand(
-    "use_mangled_mesa", cmUseMangledMesaCommand, cmPolicies::CMP0030,
-    "The use_mangled_mesa command should not be called; see CMP0030.");
+  state->AddRemovedCommand(
+    "use_mangled_mesa",
+    "The use_mangled_mesa command has been removed; see CMP0030.");
   state->AddDisallowedCommand("exec_program", cmExecProgramCommand,
                               cmPolicies::CMP0153,
                               "The exec_program command should not be called; "

+ 1 - 1
Source/cmPolicies.h

@@ -99,7 +99,7 @@ class cmMakefile;
   SELECT(POLICY, CMP0029, "The subdir_depends command should not be called.", \
          3, 0, 0, NEW)                                                        \
   SELECT(POLICY, CMP0030,                                                     \
-         "The use_mangled_mesa command should not be called.", 3, 0, 0, WARN) \
+         "The use_mangled_mesa command should not be called.", 3, 0, 0, NEW)  \
   SELECT(POLICY, CMP0031, "The load_command command should not be called.",   \
          3, 0, 0, WARN)                                                       \
   SELECT(POLICY, CMP0032,                                                     \

+ 0 - 103
Source/cmUseMangledMesaCommand.cxx

@@ -1,103 +0,0 @@
-/* Distributed under the OSI-approved BSD 3-Clause License.  See accompanying
-   file Copyright.txt or https://cmake.org/licensing for details.  */
-#include "cmUseMangledMesaCommand.h"
-
-#include "cmsys/FStream.hxx"
-#include "cmsys/RegularExpression.hxx"
-
-#include "cmExecutionStatus.h"
-#include "cmStringAlgorithms.h"
-#include "cmSystemTools.h"
-
-namespace {
-void CopyAndFullPathMesaHeader(const std::string& source,
-                               const std::string& outdir);
-}
-
-bool cmUseMangledMesaCommand(std::vector<std::string> const& args,
-                             cmExecutionStatus& status)
-{
-  // expected two arguments:
-  // argument one: the full path to gl_mangle.h
-  // argument two : directory for output of edited headers
-  if (args.size() != 2) {
-    status.SetError("called with incorrect number of arguments");
-    return false;
-  }
-  const std::string& inputDir = args[0];
-  std::string glh = cmStrCat(inputDir, "/gl.h");
-  if (!cmSystemTools::FileExists(glh)) {
-    std::string e = cmStrCat("Bad path to Mesa, could not find: ", glh, ' ');
-    status.SetError(e);
-    return false;
-  }
-  const std::string& destDir = args[1];
-  std::vector<std::string> files;
-  cmSystemTools::Glob(inputDir, "\\.h$", files);
-  if (files.empty()) {
-    cmSystemTools::Error("Could not open Mesa Directory " + inputDir);
-    return false;
-  }
-  cmSystemTools::MakeDirectory(destDir);
-  for (std::string const& f : files) {
-    std::string path = cmStrCat(inputDir, '/', f);
-    CopyAndFullPathMesaHeader(path, destDir);
-  }
-
-  return true;
-}
-
-namespace {
-void CopyAndFullPathMesaHeader(const std::string& source,
-                               const std::string& outdir)
-{
-  std::string dir;
-  std::string file;
-  cmSystemTools::SplitProgramPath(source, dir, file);
-  std::string outFile = cmStrCat(outdir, '/', file);
-  std::string tempOutputFile = cmStrCat(outFile, ".tmp");
-  cmsys::ofstream fout(tempOutputFile.c_str());
-  if (!fout) {
-    cmSystemTools::Error("Could not open file for write in copy operation: " +
-                         tempOutputFile + outdir);
-    cmSystemTools::ReportLastSystemError("");
-    return;
-  }
-  cmsys::ifstream fin(source.c_str());
-  if (!fin) {
-    cmSystemTools::Error("Could not open file for read in copy operation" +
-                         source);
-    return;
-  }
-  // now copy input to output and expand variables in the
-  // input file at the same time
-  std::string inLine;
-  // regular expression for any #include line
-  cmsys::RegularExpression includeLine(
-    "^[ \t]*#[ \t]*include[ \t]*[<\"]([^\">]+)[\">]");
-  // regular expression for gl/ or GL/ in a file (match(1) of above)
-  cmsys::RegularExpression glDirLine(R"((gl|GL)(/|\\)([^<"]+))");
-  // regular expression for gl GL or xmesa in a file (match(1) of above)
-  cmsys::RegularExpression glLine("(gl|GL|xmesa)");
-  while (cmSystemTools::GetLineFromStream(fin, inLine)) {
-    if (includeLine.find(inLine)) {
-      std::string includeFile = includeLine.match(1);
-      if (glDirLine.find(includeFile)) {
-        std::string gfile = glDirLine.match(3);
-        fout << "#include \"" << outdir << "/" << gfile << "\"\n";
-      } else if (glLine.find(includeFile)) {
-        fout << "#include \"" << outdir << "/" << includeLine.match(1)
-             << "\"\n";
-      } else {
-        fout << inLine << "\n";
-      }
-    } else {
-      fout << inLine << "\n";
-    }
-  }
-  // close the files before attempting to copy
-  fin.close();
-  fout.close();
-  cmSystemTools::MoveFileIfDifferent(tempOutputFile, outFile);
-}
-}

+ 0 - 13
Source/cmUseMangledMesaCommand.h

@@ -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 cmUseMangledMesaCommand(std::vector<std::string> const& args,
-                             cmExecutionStatus& status);

+ 2 - 2
Tests/RunCMake/DisallowedCommands/CMP0030-NEW-stderr.txt

@@ -1,4 +1,4 @@
-CMake Error at CMP0030-NEW.cmake:2 \(use_mangled_mesa\):
-  The use_mangled_mesa command should not be called; see CMP0030.
+CMake Error at CMP0030-NEW.cmake:1 \(use_mangled_mesa\):
+  The use_mangled_mesa command has been removed; see CMP0030.
 Call Stack \(most recent call first\):
   CMakeLists.txt:3 \(include\)

+ 0 - 1
Tests/RunCMake/DisallowedCommands/CMP0030-NEW.cmake

@@ -1,2 +1 @@
-cmake_policy(SET CMP0030 NEW)
 use_mangled_mesa()

+ 0 - 1
Tests/RunCMake/DisallowedCommands/CMP0030-OLD-result.txt

@@ -1 +0,0 @@
-1

+ 0 - 15
Tests/RunCMake/DisallowedCommands/CMP0030-OLD-stderr.txt

@@ -1,15 +0,0 @@
-^CMake Deprecation Warning at CMP0030-OLD.cmake:[0-9]+ \(cmake_policy\):
-  The OLD behavior for policy CMP0030 will be removed from a future version
-  of CMake.
-
-  The cmake-policies\(7\) manual explains that the OLD behaviors of all
-  policies are deprecated and that a policy should be set to OLD only under
-  specific short-term circumstances.  Projects should be ported to the NEW
-  behavior and not rely on setting a policy to OLD.
-Call Stack \(most recent call first\):
-  CMakeLists.txt:[0-9]+ \(include\)
-+
-CMake Error at CMP0030-OLD.cmake:2 \(use_mangled_mesa\):
-  use_mangled_mesa called with incorrect number of arguments
-Call Stack \(most recent call first\):
-  CMakeLists.txt:3 \(include\)$

+ 0 - 2
Tests/RunCMake/DisallowedCommands/CMP0030-OLD.cmake

@@ -1,2 +0,0 @@
-cmake_policy(SET CMP0030 OLD)
-use_mangled_mesa()

+ 0 - 1
Tests/RunCMake/DisallowedCommands/CMP0030-WARN-result.txt

@@ -1 +0,0 @@
-1

+ 0 - 12
Tests/RunCMake/DisallowedCommands/CMP0030-WARN-stderr.txt

@@ -1,12 +0,0 @@
-CMake Warning \(dev\) at CMP0030-WARN.cmake:1 \(use_mangled_mesa\):
-  Policy CMP0030 is not set: The use_mangled_mesa command should not be
-  called.  Run "cmake --help-policy CMP0030" 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 CMP0030-WARN.cmake:1 \(use_mangled_mesa\):
-  use_mangled_mesa called with incorrect number of arguments
-Call Stack \(most recent call first\):
-  CMakeLists.txt:3 \(include\)

+ 0 - 1
Tests/RunCMake/DisallowedCommands/CMP0030-WARN.cmake

@@ -1 +0,0 @@
-use_mangled_mesa()

+ 1 - 1
Tests/RunCMake/DisallowedCommands/RunCMakeTest.cmake

@@ -2,6 +2,7 @@ include(RunCMake)
 
 foreach(p
     CMP0029
+    CMP0030
     )
   run_cmake(${p}-NEW)
 endforeach()
@@ -9,7 +10,6 @@ endforeach()
 return()
 
 foreach(p
-    CMP0030
     CMP0031
     CMP0032
     CMP0033

+ 0 - 12
Tests/Wrapping/CMakeLists.txt

@@ -96,15 +96,3 @@ fltk_wrap_ui (wrapFLTK fltk2.fl)
 add_executable(wrapFLTK wrapFLTK.cxx ${wrapFLTK_FLTK_UI_SRCS})
 target_link_libraries(wrapFLTK wraplibFLTK)
 add_dependencies(wrapFLTK fakefluid)
-
-#
-# Mangled Mesa
-#
-configure_file(
-  ${Wrapping_SOURCE_DIR}/dummy
-  ${Wrapping_BINARY_DIR}/gl.h
-  COPYONLY)
-block(SCOPE_FOR POLICIES)
-cmake_policy(VERSION 2.8.12) # old enough to not set CMP0030
-use_mangled_mesa (${Wrapping_BINARY_DIR} ${Wrapping_BINARY_DIR}/mangled_mesa)
-endblock()

+ 0 - 0
Tests/Wrapping/dummy