diff options
author | Andrea Mattavelli <andreamattavelli@users.noreply.github.com> | 2017-10-05 07:50:22 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-10-05 07:50:22 +0100 |
commit | 5e6b6342dc2bc9d45a7db8fa45d7e949c55d908b (patch) | |
tree | c89cf0c6d43dba711e56c3d525fa865ce1160ac4 | |
parent | 12f0e2cd11e4bb9e0aa829f95bb437bee0e929cb (diff) | |
parent | 4f72f52f09d75f942bd1f28bf03b5abd95d9627d (diff) | |
download | klee-5e6b6342dc2bc9d45a7db8fa45d7e949c55d908b.tar.gz |
Merge pull request #757 from delcypher/cmake_clean_all
[CMake] Implement clean-all (fixes #718)
-rw-r--r-- | CMakeLists.txt | 17 | ||||
-rw-r--r-- | README-CMake.md | 6 | ||||
-rw-r--r-- | docs/CMakeLists.txt | 14 | ||||
-rw-r--r-- | runtime/CMakeLists.txt | 6 |
4 files changed, 40 insertions, 3 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index ed031459..32933e7c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -490,6 +490,23 @@ else() endif() ################################################################################ +# Global clean target +################################################################################ +# CMake already uses the "clean" target name but it doesn't clean everything +# unfortunately. We can't modify the target so we provide our own "clean_all" +# target that runs clean. Other rules for performing clean up should declare +# that "clean_all" depends on those rules. +add_custom_target(clean_all + # Invoke CMake's own clean target + COMMAND + "${CMAKE_COMMAND}" + "--build" + "${CMAKE_BINARY_DIR}" + "--target" + "clean" +) + +################################################################################ # KLEE runtime support ################################################################################ # This is set here and not in `runtime` because `config.h` needs to be generated. diff --git a/README-CMake.md b/README-CMake.md index daa1e90c..5828e319 100644 --- a/README-CMake.md +++ b/README-CMake.md @@ -6,7 +6,11 @@ its autoconf/Makefile based build system. ## Useful top level targets * `check` - Build and run all tests. -* `clean` - Clean the build tree. Note this won't clean the runtime build. +* `clean` - Invoke CMake's built-in target to clean the build tree. Note this + won't invoke the `clean_*` targets. It is advised that the `clean_all` target + is used instead. +* `clean_all` - Run all clean targets. +* `clean_doxygen` - Clean doxygen build tree. * `clean_runtime` - Clean the runtime build tree. * `docs` - Build documentation * `edit_cache` - Show cmake/ccmake/cmake-gui interface for chaning configure options. diff --git a/docs/CMakeLists.txt b/docs/CMakeLists.txt index 386298ce..f689e8a0 100644 --- a/docs/CMakeLists.txt +++ b/docs/CMakeLists.txt @@ -28,6 +28,20 @@ if (ENABLE_DOXYGEN) ${ADD_CUSTOM_COMMAND_USES_TERMINAL_ARG} ) add_dependencies(docs doc-doxygen) + + # FIXME: This variable should be used to set `OUTPUT_DIRECTORY` in + # doxygen.cfg + set(DOXYGEN_OUTPUT_DIR "${CMAKE_CURRENT_BINARY_DIR}/doxygen") + + # Add rule to clean doxygen documentation + add_custom_target(clean_doxygen + COMMAND + "${CMAKE_COMMAND}" + "-E" + "remove_directory" + "${DOXYGEN_OUTPUT_DIR}" + ) + add_dependencies(clean_all clean_doxygen) else() message(WARNING "Doxygen not found. Can't build Doxygen documentation") set(ENABLE_DOXYGEN OFF diff --git a/runtime/CMakeLists.txt b/runtime/CMakeLists.txt index c90cbda0..2a056d9f 100644 --- a/runtime/CMakeLists.txt +++ b/runtime/CMakeLists.txt @@ -115,13 +115,15 @@ ExternalProject_Add_Step(BuildKLEERuntimes RuntimeBuild ) # Target for cleaning the bitcode build system -# FIXME: Invoke `make clean` does not invoke this target. It's also weird -# that `ExternalProject` provides no way to do a clean. +# NOTE: Invoking `make clean` does not invoke this target. +# Instead the user needs to invoke the `clean_all` target. +# It's also weird that `ExternalProject` provides no way to do a clean. add_custom_target(clean_runtime COMMAND ${ENV_BINARY} MAKEFLAGS="" ${MAKE_BINARY} -f Makefile.cmake.bitcode clean WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}" ${ADD_CUSTOM_COMMAND_USES_TERMINAL_ARG} ) +add_dependencies(clean_all clean_runtime) ############################################################################### # Runtime install |