diff options
Diffstat (limited to 'cmake/tools.cmake')
-rw-r--r-- | cmake/tools.cmake | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/cmake/tools.cmake b/cmake/tools.cmake new file mode 100644 index 0000000..3526dba --- /dev/null +++ b/cmake/tools.cmake @@ -0,0 +1,15 @@ +MACRO(PYTHON_CLEAN_LIST PYPATH RESULT) + file(GLOB_RECURSE PYTHON_FILES "${PYPATH}/*.py") + + set(CLEAN_LIST "") + set(PYTHON_DIRS "") + foreach(ITEM ${PYTHON_FILES}) + get_filename_component(DIR ${ITEM} PATH) # Later version may require to use DIRECTORY instead of PATH + list(APPEND PYTHON_DIRS "${DIR}/__pycache__") + list(APPEND CLEAN_LIST "${ITEM}c") + endforeach(ITEM ${PYTHON_FILES}) + list(REMOVE_DUPLICATES PYTHON_DIRS) + list(APPEND CLEAN_LIST ${PYTHON_DIRS}) + + set(${RESULT} ${CLEAN_LIST}) +ENDMACRO(PYTHON_CLEAN_LIST PYPATH CLEAN_LIST) |