Separate clean from distclean
clean removes what the build produced and leaves the configured build system, so a build following it proceeds without reconfiguring. Deleting the build system from clean broke that: the target lives in the Makefile it removes, so nothing in the directory could drive a rebuild afterward. distclean empties the directory, build system included. It is terminal — the next step is `cmake -B <dir>` from outside — and it is what proves a change against a tree carrying no state from earlier runs.
This commit is contained in:
@@ -132,23 +132,49 @@ add_subdirectory(docs ${CMAKE_BINARY_DIR}/docs-build)
|
|||||||
# ---------------------------------------------------------------------
|
# ---------------------------------------------------------------------
|
||||||
# Clean
|
# Clean
|
||||||
# ---------------------------------------------------------------------
|
# ---------------------------------------------------------------------
|
||||||
# clean removes what the build produced: the artifact directories, the
|
# clean removes everything the build produced and leaves the configured
|
||||||
# generated documentation, and the test scratch areas.
|
# build system in place, so the next build proceeds from the directory
|
||||||
#
|
# as it stands.
|
||||||
# The generated build system stays. CMakeCache.txt, the makefiles,
|
|
||||||
# CMakeFiles/, and the CMake file API directory under .cmake/ are what an
|
|
||||||
# IDE reads to know the project's targets exist; deleting them leaves the
|
|
||||||
# directory unconfigured, so every target in the IDE stops resolving until
|
|
||||||
# the project is reloaded. Removing the build system is what configuring a
|
|
||||||
# fresh directory is for.
|
|
||||||
set_property(DIRECTORY APPEND PROPERTY ADDITIONAL_CLEAN_FILES
|
set_property(DIRECTORY APPEND PROPERTY ADDITIONAL_CLEAN_FILES
|
||||||
${DPM_TEST_RESULTS_DIR}
|
# Build artifacts.
|
||||||
${CMAKE_BINARY_DIR}/Testing
|
|
||||||
${CMAKE_BINARY_DIR}/bin
|
${CMAKE_BINARY_DIR}/bin
|
||||||
${CMAKE_BINARY_DIR}/lib
|
${CMAKE_BINARY_DIR}/lib
|
||||||
${CMAKE_BINARY_DIR}/modules
|
${CMAKE_BINARY_DIR}/modules
|
||||||
${DPM_TEST_DIR}
|
${DPM_TEST_DIR}
|
||||||
${DPM_DOCS_DIR}
|
${DPM_DOCS_DIR}
|
||||||
|
|
||||||
|
# Test scratch areas.
|
||||||
|
${DPM_TEST_RESULTS_DIR}
|
||||||
|
${CMAKE_BINARY_DIR}/Testing
|
||||||
|
)
|
||||||
|
|
||||||
|
# distclean empties the build directory, the generated build system
|
||||||
|
# included, leaving what a freshly created directory holds: nothing.
|
||||||
|
#
|
||||||
|
# It is a terminal operation. Nothing inside the directory can drive a
|
||||||
|
# build afterwards, so the next step is `cmake -B <dir>` from outside
|
||||||
|
# it. Use it to prove a change against a tree carrying no state from
|
||||||
|
# earlier runs.
|
||||||
|
add_custom_target(distclean
|
||||||
|
COMMAND ${CMAKE_COMMAND} -E rm -rf
|
||||||
|
${CMAKE_BINARY_DIR}/bin
|
||||||
|
${CMAKE_BINARY_DIR}/lib
|
||||||
|
${CMAKE_BINARY_DIR}/modules
|
||||||
|
${DPM_TEST_DIR}
|
||||||
|
${DPM_DOCS_DIR}
|
||||||
|
${DPM_TEST_RESULTS_DIR}
|
||||||
|
${CMAKE_BINARY_DIR}/Testing
|
||||||
|
${CMAKE_BINARY_DIR}/CMakeFiles
|
||||||
|
${CMAKE_BINARY_DIR}/CMakeCache.txt
|
||||||
|
${CMAKE_BINARY_DIR}/Makefile
|
||||||
|
${CMAKE_BINARY_DIR}/cmake_install.cmake
|
||||||
|
${CMAKE_BINARY_DIR}/CTestTestfile.cmake
|
||||||
|
${CMAKE_BINARY_DIR}/DartConfiguration.tcl
|
||||||
|
${CMAKE_BINARY_DIR}/.cmake
|
||||||
|
${CMAKE_BINARY_DIR}/CMakeDoxyfile.in
|
||||||
|
${CMAKE_BINARY_DIR}/CMakeDoxygenDefaults.cmake
|
||||||
|
${CMAKE_BINARY_DIR}/docs-build
|
||||||
|
COMMENT "Emptying the build directory"
|
||||||
)
|
)
|
||||||
|
|
||||||
# ---------------------------------------------------------------------
|
# ---------------------------------------------------------------------
|
||||||
|
|||||||
Reference in New Issue
Block a user