linux CMakeLists.txt: don't call file(REMOVE) if the glob list is empty

This commit is contained in:
Pato05 2024-02-17 15:07:36 +01:00
parent 6e220073d8
commit 14ff02b65c
No known key found for this signature in database
GPG Key ID: F53CA394104BA0CB
1 changed files with 4 additions and 2 deletions

View File

@ -147,11 +147,13 @@ endif()
if(NOT CMAKE_BUILD_TYPE MATCHES "Debug")
# Remove old tarballs
file(GLOB REMOVE_OLD_TARBALLS ${PROJECT_BINARY_DIR}/freezer-linux-*.tar.gz)
file(REMOVE ${REMOVE_OLD_TARBALLS})
if (REMOVE_OLD_TARBALLS)
file(REMOVE ${REMOVE_OLD_TARBALLS})
endif()
# Configure the script to create a new tarball, and run it as a target
configure_file(create-tarball.sh ${PROJECT_BINARY_DIR} @ONLY
FILE_PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ)
add_custom_target(create_tar ALL COMMAND "${PROJECT_BINARY_DIR}/create-tarball.sh")
add_dependencies(create_tar ${BINARY_NAME})
endif()
endif()