diff --git a/CMLibDisableInSourceBuild.cmake b/CMLibDisableInSourceBuild.cmake index be6f62b..4e7f2df 100644 --- a/CMLibDisableInSourceBuild.cmake +++ b/CMLibDisableInSourceBuild.cmake @@ -12,3 +12,18 @@ if(${_source_realpath} STREQUAL ${_binary_realpath}) message(FATAL_ERROR "In-source builds are not allowed.") endif() +# Очистка от сгенерированных файлов +file(GLOB_RECURSE _cmakelists_files RELATIVE ${_source_realpath} CMakeLists.txt) +foreach(_it ${_cmakelists_files}) + get_filename_component(_file ${_it} REALPATH) + get_filename_component(_dir ${_file} DIRECTORY) + file(REMOVE_RECURSE + ${_dir}/CMakeFiles + ${_dir}/CMakeCache.txt + ${_dir}/cmake_install.cmake + ${_dir}/Makefile + ${_dir}/build.ninja + ${_dir}/rules.ninja + ) +endforeach() +