opm-simulators/cmake/Scripts/RemoveEmptyDir.cmake
2013-05-15 10:24:52 +02:00

16 lines
333 B
CMake

# - Remove a directory if and only if it contains no files
#
# Pass the name of the directory as the DIR variable
if (DIR)
# check if empty
file (GLOB_RECURSE files "${DIR}/*")
# remove only if
if (NOT files)
execute_process (COMMAND
${CMAKE_COMMAND} -E remove_directory "${DIR}"
)
endif (NOT files)
endif (DIR)