about summary refs log tree commit diff homepage
diff options
context:
space:
mode:
-rw-r--r--docs/CMakeLists.txt17
1 files changed, 8 insertions, 9 deletions
diff --git a/docs/CMakeLists.txt b/docs/CMakeLists.txt
index 6f4168c3..5cab7b4a 100644
--- a/docs/CMakeLists.txt
+++ b/docs/CMakeLists.txt
@@ -33,15 +33,14 @@ if (ENABLE_DOXYGEN)
     # 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)
+    if ("${CMAKE_VERSION}" VERSION_LESS "3.15")
+      set_directory_properties(PROPERTY ADDITIONAL_MAKE_CLEAN_FILES
+              "${DOXYGEN_OUTPUT_DIR}")
+    else ()
+      set_directory_properties(PROPERTY ADDITIONAL_CLEAN_FILES
+              "${DOXYGEN_OUTPUT_DIR}")
+    endif ()
+
   else()
     message(WARNING "Doxygen not found. Can't build Doxygen documentation")
     set(ENABLE_DOXYGEN OFF