Fix bad add_custom_command() in distclean target

`add_custom_command()` has 2 formats: OUTPUT and TARGET. This is TARGET,
but TARGET does not permit OUTPUT.

see https://cmake.org/cmake/help/v3.31/policy/CMP0175.html
and https://cmake.org/cmake/help/v3.31/command/add_custom_command.html

Also, I converted to now-prefered lowercase (only lowercase works in my
IDE to pull up context-sensitive help for CMake). And I replaced a Make-
oriented COMMAND on `add_custom_target()` to a proper `COMMENT`.
This commit is contained in:
Dan Dennedy
2025-04-03 15:46:55 -07:00
committed by Jaromil
parent 85f6e9dba2
commit 1f8e21e27f

View File

@@ -3,9 +3,11 @@
# Jan Woetzel 04/2003 # Jan Woetzel 04/2003
# #
IF (UNIX) if(UNIX)
ADD_CUSTOM_TARGET (distclean @echo cleaning for source distribution) add_custom_target(distclean
SET(DISTCLEANED COMMENT "cleaning for source distribution"
)
set(DISTCLEANED
cmake.depends cmake.depends
cmake.check_depends cmake.check_depends
CMakeCache.txt CMakeCache.txt
@@ -16,13 +18,17 @@ IF (UNIX)
gmon.out gmon.out
*~ *~
) )
add_custom_command(
ADD_CUSTOM_COMMAND( COMMENT "running target clean"
DEPENDS clean TARGET distclean
COMMAND ${CMAKE_COMMAND} --build ${CMAKE_BINARY_DIR} --target clean
)
add_custom_command(
POST_BUILD
COMMENT "distribution clean" COMMENT "distribution clean"
COMMAND rm COMMAND rm
ARGS -Rf CMakeTmp ${DISTCLEANED} ARGS -Rf CMakeTmp ${DISTCLEANED}
TARGET distclean TARGET distclean
) )
ENDIF(UNIX) endif(UNIX)