Browse Source

CMP0175: Do not reject USES_TERMINAL for add_custom_command(TARGET)

Fixes: #26449
Craig Scott 1 year ago
parent
commit
62586f236c

+ 2 - 1
Help/command/add_custom_command.rst

@@ -599,7 +599,8 @@ target is already built, the command will not execute.
                      [WORKING_DIRECTORY dir]
                      [WORKING_DIRECTORY dir]
                      [COMMENT comment]
                      [COMMENT comment]
                      [VERBATIM]
                      [VERBATIM]
-                     [COMMAND_EXPAND_LISTS])
+                     [COMMAND_EXPAND_LISTS]
+                     [USES_TERMINAL])
 
 
 This defines a new command that will be associated with building the
 This defines a new command that will be associated with building the
 specified ``<target>``.  The ``<target>`` must be defined in the current
 specified ``<target>``.  The ``<target>`` must be defined in the current

+ 2 - 2
Help/policy/CMP0175.rst

@@ -24,8 +24,8 @@ following as errors that previously went unreported:
   ``POST_BUILD`` to be given.  Previously, if none were given, ``POST_BUILD``
   ``POST_BUILD`` to be given.  Previously, if none were given, ``POST_BUILD``
   was assumed, or if multiple keywords were given, the last one was used.
   was assumed, or if multiple keywords were given, the last one was used.
 * The ``TARGET`` form does not accept ``DEPENDS``, ``DEPENDS_EXPLICIT_ONLY``,
 * The ``TARGET`` form does not accept ``DEPENDS``, ``DEPENDS_EXPLICIT_ONLY``,
-  ``DEPFILE``, ``IMPLICIT_DEPENDS``, ``MAIN_DEPENDENCY``, ``JOB_POOL``,
-  ``JOB_SERVER_AWARE``, or ``USES_TERMINAL`` keywords.
+  ``DEPFILE``, ``IMPLICIT_DEPENDS``, ``MAIN_DEPENDENCY``, ``JOB_POOL``, or
+  ``JOB_SERVER_AWARE`` keywords.
 * The ``TARGET`` form now requires at least one ``COMMAND`` to be given.
 * The ``TARGET`` form now requires at least one ``COMMAND`` to be given.
 * If a keyword expects a value to be given after it, but no value is provided,
 * If a keyword expects a value to be given after it, but no value is provided,
   that was previously treated as though the keyword was not given at all.
   that was previously treated as though the keyword was not given at all.

+ 1 - 0
Source/cmAddCustomCommandCommand.cxx

@@ -155,6 +155,7 @@ bool cmAddCustomCommandCommand(std::vector<std::string> const& args,
     keyPRE_BUILD,
     keyPRE_BUILD,
     keyPRE_LINK,
     keyPRE_LINK,
     keyTARGET,
     keyTARGET,
+    keyUSES_TERMINAL,
     keyVERBATIM,
     keyVERBATIM,
     keyWORKING_DIRECTORY
     keyWORKING_DIRECTORY
   };
   };

+ 1 - 1
Tests/RunCMake/add_custom_command/CMP0175-NEW-stderr.txt

@@ -9,7 +9,7 @@ Call Stack \(most recent call first\):
 
 
 CMake Error at CMP0175\.cmake:[0-9]+ \(add_custom_command\):
 CMake Error at CMP0175\.cmake:[0-9]+ \(add_custom_command\):
   The following keywords are not supported when using
   The following keywords are not supported when using
-  add_custom_command\(TARGET\): IMPLICIT_DEPENDS, USES_TERMINAL
+  add_custom_command\(TARGET\): IMPLICIT_DEPENDS
 Call Stack \(most recent call first\):
 Call Stack \(most recent call first\):
   CMP0175-NEW\.cmake:2 \(include\)
   CMP0175-NEW\.cmake:2 \(include\)
   CMakeLists\.txt:3 \(include\)
   CMakeLists\.txt:3 \(include\)

+ 1 - 1
Tests/RunCMake/add_custom_command/CMP0175-WARN-stderr.txt

@@ -13,7 +13,7 @@ This warning is for project developers\.  Use -Wno-dev to suppress it\.
 
 
 CMake Warning \(dev\) at CMP0175\.cmake:[0-9]+ \(add_custom_command\):
 CMake Warning \(dev\) at CMP0175\.cmake:[0-9]+ \(add_custom_command\):
   The following keywords are not supported when using
   The following keywords are not supported when using
-  add_custom_command\(TARGET\): IMPLICIT_DEPENDS, USES_TERMINAL\.
+  add_custom_command\(TARGET\): IMPLICIT_DEPENDS\.
 
 
   Policy CMP0175 is not set: add_custom_command\(\) rejects invalid arguments\.
   Policy CMP0175 is not set: add_custom_command\(\) rejects invalid arguments\.
   Run "cmake --help-policy CMP0175" for policy details\.  Use the cmake_policy
   Run "cmake --help-policy CMP0175" for policy details\.  Use the cmake_policy

+ 3 - 2
Tests/RunCMake/add_custom_command/CMP0175.cmake

@@ -24,14 +24,15 @@ add_custom_command(TARGET main
   #OUTPUT   # Other checks will fail before the CMP0175 check
   #OUTPUT   # Other checks will fail before the CMP0175 check
   #OUTPUTS  # Special case, not a documented keyword (used for deprecated form)
   #OUTPUTS  # Special case, not a documented keyword (used for deprecated form)
   #SOURCE   # Old signature, special handling makes it hard to check
   #SOURCE   # Old signature, special handling makes it hard to check
-  #USES_TERMINAL
 )
 )
 add_custom_command(TARGET main
 add_custom_command(TARGET main
   POST_BUILD
   POST_BUILD
   COMMAND ${CMAKE_COMMAND} -E true
   COMMAND ${CMAKE_COMMAND} -E true
   # Has to be tested separately due to separate check for clash with DEPFILE
   # Has to be tested separately due to separate check for clash with DEPFILE
   IMPLICIT_DEPENDS valueDoesNotMatterHere
   IMPLICIT_DEPENDS valueDoesNotMatterHere
-  # Has to be tested separately due to separate check for clash with JOB_POOL
+  # Has to be tested separately due to separate check for clash with JOB_POOL.
+  # This one is supported, but was erroneously rejected in the 3.31.0 release.
+  # We keep this here to verify the fix for that regression.
   USES_TERMINAL NO
   USES_TERMINAL NO
 )
 )