CMP0175: Do not reject USES_TERMINAL for add_custom_command(TARGET)

Fixes: #26449
This commit is contained in:
Craig Scott 2024-11-16 10:02:01 +11:00
parent 0dffd05287
commit 62586f236c
No known key found for this signature in database
GPG Key ID: 6FF37CBDCCADED9F
6 changed files with 10 additions and 7 deletions

View File

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

View File

@ -24,8 +24,8 @@ following as errors that previously went unreported:
``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.
* 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.
* 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.

View File

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

View File

@ -9,7 +9,7 @@ Call Stack \(most recent call first\):
CMake Error at CMP0175\.cmake:[0-9]+ \(add_custom_command\):
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\):
CMP0175-NEW\.cmake:2 \(include\)
CMakeLists\.txt:3 \(include\)

View File

@ -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\):
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\.
Run "cmake --help-policy CMP0175" for policy details\. Use the cmake_policy

View File

@ -24,14 +24,15 @@ add_custom_command(TARGET main
#OUTPUT # Other checks will fail before the CMP0175 check
#OUTPUTS # Special case, not a documented keyword (used for deprecated form)
#SOURCE # Old signature, special handling makes it hard to check
#USES_TERMINAL
)
add_custom_command(TARGET main
POST_BUILD
COMMAND ${CMAKE_COMMAND} -E true
# Has to be tested separately due to separate check for clash with DEPFILE
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
)