From 765d9b032fe099ea0b3ccb32404e85809e0173e2 Mon Sep 17 00:00:00 2001 From: Soonho Kong Date: Sun, 14 Sep 2014 01:40:21 -0700 Subject: [PATCH] feat(src/cmake/modules/CleanOlean.cmake): add CleanOlean.cmake Instead of using 'find -delete', use CMAKE's FILE GLOB_RECURSE and FILE REMOVE to implement clean-olean. Related issue: #166 --- src/CMakeLists.txt | 6 +++--- src/cmake/Modules/CleanOlean.cmake | 25 +++++++++++++++++++++++++ 2 files changed, 28 insertions(+), 3 deletions(-) create mode 100644 src/cmake/Modules/CleanOlean.cmake diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 196843f9c..8d5dde1d4 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -319,6 +319,6 @@ if((${CYGWIN} EQUAL "1") OR (NOT (${CMAKE_SYSTEM_NAME} MATCHES "Windows"))) endif() add_custom_target(clean-olean - WORKING_DIRECTORY ${LEAN_SOURCE_DIR}/../library - COMMAND find . -type f -name '*.olean' -delete && find . -type f -name '*.d' -delete && find . -type f -name '*.clean' -delete && find . -type f -name '*.ilean' -delete && find . -type f -name 'TAGS' -delete - ) + WORKING_DIRECTORY ${LEAN_SOURCE_DIR}/../library + COMMAND ${CMAKE_COMMAND} -P ${CMAKE_MODULE_PATH}CleanOlean.cmake + ) diff --git a/src/cmake/Modules/CleanOlean.cmake b/src/cmake/Modules/CleanOlean.cmake new file mode 100644 index 000000000..d99f13920 --- /dev/null +++ b/src/cmake/Modules/CleanOlean.cmake @@ -0,0 +1,25 @@ +FILE(GLOB_RECURSE OLEAN_FILES ${CMAKE_CURRENT_SOURCE_DIR} *.olean) +FILE(GLOB_RECURSE D_FILES ${CMAKE_CURRENT_SOURCE_DIR} *.d) +FILE(GLOB_RECURSE CLEAN_FILES ${CMAKE_CURRENT_SOURCE_DIR} *.clean) +FILE(GLOB_RECURSE ILEAN_FILES ${CMAKE_CURRENT_SOURCE_DIR} *.ilean) +FILE(GLOB_RECURSE TAGS_FILES ${CMAKE_CURRENT_SOURCE_DIR} TAGS) + +IF(OLEAN_FILES) + FILE(REMOVE ${OLEAN_FILES}) +ENDIF() + +IF(D_FILES) + FILE(REMOVE ${D_FILES}) +ENDIF() + +IF(CLEAN_FILES) + FILE(REMOVE ${CLEAN_FILES}) +ENDIF() + +IF(ILEAN_FILES) + FILE(REMOVE ${ILEAN_FILES}) +ENDIF() + +IF(TAGS_FILES) + FILE(REMOVE ${TAGS_FILES}) +ENDIF()