From 5aaef2b631eee993377da85f234cf1b8a441b8c8 Mon Sep 17 00:00:00 2001 From: Torsten Wierschin Date: Tue, 21 Jul 2026 15:23:35 +0200 Subject: [PATCH] CMake: improve MIGRATE_MODULE subdir matching to handle nested paths (e.g., Lts/Proxies/TrainingAreaBase)\n\nInclude subdirectories when MIGRATE_MODULE contains the subdir as a path component so nested module selection works.\n\nCo-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- CMakeLists.txt | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 808dedda2..f6382ed97 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -343,7 +343,15 @@ function(NGL_ADD_SUBDIR_GUARDED subdir) # also compare basenames so MIGRATE_MODULE=Lts/DDS matches subdir 'DDS' when called from Lts get_filename_component(_mig_base "${_mig}" NAME) get_filename_component(_sub_base "${_sub}" NAME) - if(_mig MATCHES "^${_sub}(/|$)" OR _sub MATCHES "^${_mig}(/|$)" OR _mig_base STREQUAL _sub OR _sub_base STREQUAL _mig) + # If MIGRATE_MODULE either starts with the subdir, equals it, contains it as a path component, + # or the basename matches, include the subdir. This makes nested paths like + # 'Lts/Proxies/TrainingAreaBase' include both 'Lts' and its child 'Proxies'. + if(_mig MATCHES "^${_sub}(/|$)" \ + OR _sub MATCHES "^${_mig}(/|$)" \ + OR _mig MATCHES ".*/${_sub}(/|$)" \ + OR _sub MATCHES ".*/${_mig}(/|$)" \ + OR _mig_base STREQUAL _sub \ + OR _sub_base STREQUAL _mig) message(STATUS "Including subdir ${subdir} because MIGRATE_MODULE=${MIGRATE_MODULE}") add_subdirectory(${subdir}) else()