From 25ed4d74de43aa486f5254bde64899ce20dfd404 Mon Sep 17 00:00:00 2001 From: Viktor Szakats Date: Wed, 3 Sep 2025 10:12:36 +0200 Subject: [PATCH] cmake: make `clean-coverage` target portable By using cmake's built-in commands instead of expecting the shell to support `rm -rf`. Closes #1647 --- tests/CMakeLists.txt | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index b05c4c26..f7e0699f 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -167,8 +167,13 @@ add_custom_target(coverage COMMAND gcovr --root "${PROJECT_SOURCE_DIR}" --exclude tests/* --html-details --output "${CMAKE_CURRENT_BINARY_DIR}/coverage/index.html") -add_custom_target(clean-coverage - COMMAND rm -rf "${CMAKE_CURRENT_BINARY_DIR}/coverage") +if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.17) + add_custom_target(clean-coverage COMMAND ${CMAKE_COMMAND} -E rm -rf -- + "${CMAKE_CURRENT_BINARY_DIR}/coverage") +else() + add_custom_target(clean-coverage COMMAND ${CMAKE_COMMAND} -E remove_directory + "${CMAKE_CURRENT_BINARY_DIR}/coverage") +endif() libssh2_add_target_to_copy_dependencies( TARGET copy_test_dependencies