cmake: make NGL_ADD_SUBDIR_GUARDED match by basename so MIGRATE_MODULE=Lts/DDS picks Lts/DDS correctly

This commit is contained in:
Copilot authored and Torsten Wierschin committed 2026-07-20 13:12:03 +02:00
1 parent 01f8dd0d09
commit 14988660cd
1 file changed
+4 -1
+4 -1
View File
@@ -340,7 +340,10 @@ function(NGL_ADD_SUBDIR_GUARDED subdir)
# normalize to forward slashes
string(REPLACE "\\" "/" _mig "${MIGRATE_MODULE}")
string(REPLACE "\\" "/" _sub "${subdir}")
if(_mig MATCHES "^${_sub}(/|$)" OR _sub MATCHES "^${_mig}(/|$)")
# 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)
message(STATUS "Including subdir ${subdir} because MIGRATE_MODULE=${MIGRATE_MODULE}")
add_subdirectory(${subdir})
else()