1 #[[ mitkCleanExternalProject(<ep_name>) 3 The MITK superbuild script stores hashes of all external project scripts
4 and compares them with previous hashes,
if they exist. This comparison
5 potentially detects changes
in an external project that may require
6 cleaning of previous build artifacts to prevent MITK from referring to
7 mixed versions of the same external project.
9 This
function tries to mimic the manual cleaning of old build articafts
10 by removing the source, build, and stamp directory of the external project
11 as well as all files
in the external project
's install manifest, if found. 13 The motivation for this function is to improve build times in continuous 14 integration and to make non-nightly build clients more robust against 15 external project updates. 17 function(mitkCleanExternalProject ep_name) 18 message(STATUS "Cleaning '${ep_name}
'") 20 set(source_dir "${ep_prefix}/src/${ep_name}") 21 set(binary_dir "${source_dir}-build") 22 set(stamp_dir "${source_dir}-stamp") 24 set(install_manifest_file "${binary_dir}/install_manifest.txt") 25 if(EXISTS ${install_manifest_file}) 26 message(STATUS " Validating install manifest") 27 string(LENGTH ${CMAKE_BINARY_DIR} cmake_binary_dir_length) 28 file(STRINGS ${install_manifest_file} installed_files) 29 foreach(f ${installed_files}) 30 string(SUBSTRING "${f}" 0 ${cmake_binary_dir_length} f_prefix) 31 if(NOT f_prefix STREQUAL CMAKE_BINARY_DIR) 32 message(FATAL_ERROR "'${f}
' in ${install_manifest_file}' refers to a file outside of
'${CMAKE_BINARY_DIR}'!
") 35 message(STATUS " Uninstalling
") 36 file(REMOVE ${installed_files}) 40 message(STATUS " Removing source directory
") 41 file(REMOVE_RECURSE ${source_dir}) 45 message(STATUS " Removing build directory
") 46 file(REMOVE_RECURSE ${binary_dir}) 50 message(STATUS " Removing stamp directory
") 51 file(REMOVE_RECURSE ${stamp_dir}) static bool in(Reader::Char c, Reader::Char c1, Reader::Char c2, Reader::Char c3, Reader::Char c4)