Files
frei0r/cmake/modules/TargetDistclean.cmake
Dan Dennedy 1f8e21e27f 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`.
2025-04-07 14:26:17 +02:00

35 lines
672 B
CMake

# add custom target distclean
# cleans and removes cmake generated files etc.
# Jan Woetzel 04/2003
#
if(UNIX)
add_custom_target(distclean
COMMENT "cleaning for source distribution"
)
set(DISTCLEANED
cmake.depends
cmake.check_depends
CMakeCache.txt
cmake.check_cache
*.cmake
Makefile
core core.*
gmon.out
*~
)
add_custom_command(
COMMENT "running target clean"
TARGET distclean
COMMAND ${CMAKE_COMMAND} --build ${CMAKE_BINARY_DIR} --target clean
)
add_custom_command(
POST_BUILD
COMMENT "distribution clean"
COMMAND rm
ARGS -Rf CMakeTmp ${DISTCLEANED}
TARGET distclean
)
endif(UNIX)