# SPDX-License-Identifier: Apache-2.0

# Purpose of this CMake file is to clean all CMake files generated by CMake when
# exporting Zephry to CMake user package registry.

# Get a list of all files.
file(GLOB_RECURSE GENERATED_FILES
     LIST_DIRECTORIES true
     ${CMAKE_CURRENT_LIST_DIR}/*
)

# Remove the files that is used be Zephyr from the list.
list(REMOVE_ITEM GENERATED_FILES
     "${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt"
     "${CMAKE_CURRENT_LIST_DIR}/pristine.cmake"
     "${CMAKE_CURRENT_LIST_DIR}/zephyr_package_search.cmake"
     "${CMAKE_CURRENT_LIST_DIR}/ZephyrConfigVersion.cmake"
     "${CMAKE_CURRENT_LIST_DIR}/ZephyrConfig.cmake"
)

# Delete everything else, as those files are created by CMake.
file(REMOVE_RECURSE ${GENERATED_FILES})
