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
This commit is contained in:
Soonho Kong 2014-09-14 01:40:21 -07:00
parent 2d29d6d319
commit 765d9b032f
2 changed files with 28 additions and 3 deletions

View file

@ -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
)

View file

@ -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()