build(grantlee): strip explicit QT_TESTCASE_BUILDDIR target_compile_definitions to avoid macro redefinition; keep Qt6 Test find_package injection
This commit is contained in:
1 parent
658051a8ea
commit
faa891b573
1 file changed
+13
@@ -67,6 +67,19 @@ for p in Path('.').rglob('*'):
|
||||
except Exception as e:
|
||||
print('Skipping', p, 'error', e)
|
||||
|
||||
# remove explicit QT_TESTCASE_BUILDDIR compile definitions to avoid duplicate -D on command line
|
||||
pat_qt_test_def = re.compile(r"^\s*target_compile_definitions\([^\n]*QT_TESTCASE_BUILDDIR[^\n]*\)\s*$", re.M)
|
||||
for p in Path('.').rglob('*'):
|
||||
if p.is_file() and p.name=='CMakeLists.txt':
|
||||
try:
|
||||
s = p.read_text()
|
||||
s2 = pat_qt_test_def.sub(lambda m: '# PATCHED: removed QT_TESTCASE_BUILDDIR definition to avoid macro redefinition', s)
|
||||
if s2 != s:
|
||||
p.write_text(s2)
|
||||
print('Removed QT_TESTCASE_BUILDDIR in', p)
|
||||
except Exception as e:
|
||||
print('Skipping', p, 'error', e)
|
||||
|
||||
# ensure files linking to Qt6::Test have a find_package(Qt6 Test REQUIRED)
|
||||
for p in Path('.').rglob('*'):
|
||||
if p.is_file() and (p.name=='CMakeLists.txt' or p.suffix=='.cmake'):
|
||||
|
||||
Reference in new issue
Block a user