1# Distributed under the OSI-approved BSD 3-Clause License. See accompanying 2# file Copyright.txt or https://cmake.org/licensing for details. 3 4 5if (ACTION STREQUAL "CLEAN") 6 # Collect current list of generated files 7 file (GLOB_RECURSE files LIST_DIRECTORIES TRUE RELATIVE "${SUPPORT_FILES_WORKING_DIRECTORY}" "${SUPPORT_FILES_WORKING_DIRECTORY}/*") 8 9 if (files) 10 # clean-up the output directory 11 ## compute full paths 12 list (TRANSFORM files PREPEND "${SUPPORT_FILES_OUTPUT_DIRECTORY}/") 13 ## remove generated files from the output directory 14 file (REMOVE ${files}) 15 16 # clean-up working directory 17 file (REMOVE_RECURSE "${SUPPORT_FILES_WORKING_DIRECTORY}") 18 endif() 19 20 file (MAKE_DIRECTORY "${SUPPORT_FILES_WORKING_DIRECTORY}") 21endif() 22 23if (ACTION STREQUAL "COPY") 24 # Collect current list of generated files 25 file (GLOB files LIST_DIRECTORIES TRUE "${SUPPORT_FILES_WORKING_DIRECTORY}/*") 26 27 if (files) 28 # copy files to the output directory 29 file (COPY ${files} DESTINATION "${SUPPORT_FILES_OUTPUT_DIRECTORY}") 30 endif() 31endif() 32