Files
cinema-ticket-management-sy…/cmake/generation/ProjectTree.cmake
T
2026-07-12 14:34:52 +04:00

22 lines
740 B
CMake

# Ensure artifacts directory exists
file(MAKE_DIRECTORY "${ARTIFACTS_DIR}")
# Collecting all files in the project, excluding artifacts and build directories
file(GLOB_RECURSE PROJECT_FILES
RELATIVE "${CMAKE_SOURCE_DIR}"
"*"
)
list(FILTER PROJECT_FILES EXCLUDE REGEX "^(artifacts/|build/|external/)")
# Generate directory tree
add_custom_command(
OUTPUT "${ARTIFACTS_DIR}/tree.txt"
COMMAND tree -I 'artifacts|build|external' "${CMAKE_SOURCE_DIR}" > "${ARTIFACTS_DIR}/tree.txt"
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
DEPENDS ${PROJECT_FILES}
COMMENT "Generating directory tree in ${ARTIFACTS_DIR}/tree.txt"
)
# Create GenerateTree target
add_custom_target(GenerateTree ALL DEPENDS "${ARTIFACTS_DIR}/tree.txt")