diff --git a/bin/extract_as_new_module.py b/bin/extract_as_new_module.py index dcc59af2a03908439304254ac90ead797393791a..f7d2c46d67f42c0afc3995ae1d158b0627580259 100755 --- a/bin/extract_as_new_module.py +++ b/bin/extract_as_new_module.py @@ -13,6 +13,7 @@ import argparse import shutil import textwrap import itertools +import glob import multiprocessing as mp from distutils.dir_util import copy_tree from pathlib import Path @@ -638,6 +639,16 @@ if __name__ == "__main__": newModulePath, ) + # get the CMake macro file name of the new module + cmakeMacroPattern = os.path.join(newModulePath, "cmake/modules/*Macros.cmake") + sourceCMakeMacroName = glob.glob(cmakeMacroPattern)[0] + # remove the generated CMake directory and copy the one from the source module + shutil. rmtree(os.path.join(newModulePath, "cmake")) + copySubFolders(["cmake"], modulePath, newModulePath) + # get the name of the extracted CMake macro file name and rename it to match the new module name + newModuleCMakeMacroFile = glob.glob(cmakeMacroPattern)[0] + os.rename(newModuleCMakeMacroFile, sourceCMakeMacroName) + # guide user through removal of possibly unnecessary folders foldersWithoutSources = foldersWithoutSourceFiles( newModulePath, subFolder, newHeaders + newSourceFiles