ManageSupportFiles.cmake 1.0 KB

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