- Wrap FIND_PACKAGE(RTI) in IF(NOT TARGET RTI::nddsc) condition - Prevents placeholder targets from overwriting manually configured RTI:: targets - Manual configuration creates RTI:: targets when BUILD_RTI=ON and RTI found - FIND_PACKAGE only called as fallback when manual config doesn't create targets Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Entire-Checkpoint: 01M1CT3XSQXCX9RQR6WM9DG3GH
47 lines
1.8 KiB
Python
47 lines
1.8 KiB
Python
#!/usr/bin/env python3
|
|
"""Fix QPainterPath includes from QtCore to QtGui"""
|
|
import os
|
|
import re
|
|
import sys
|
|
|
|
def fix_qpainterpath_includes(root_dir):
|
|
"""Fix QPainterPath includes from QtCore to QtGui"""
|
|
files_fixed = 0
|
|
total_fixes = 0
|
|
|
|
# Walk through all directories
|
|
for dirpath, dirnames, filenames in os.walk(root_dir):
|
|
# Skip build directories
|
|
if 'build' in dirpath or dirpath.endswith('/build'):
|
|
continue
|
|
|
|
for filename in filenames:
|
|
if filename.endswith('.h') or filename.endswith('.cpp'):
|
|
filepath = os.path.join(dirpath, filename)
|
|
|
|
try:
|
|
with open(filepath, 'r', encoding='utf-8', errors='ignore') as f:
|
|
content = f.read()
|
|
|
|
# Check for QtCore/QPainterPath
|
|
if '<QtCore/QPainterPath>' in content:
|
|
# Replace with QtGui/QPainterPath
|
|
new_content = content.replace('<QtCore/QPainterPath>', '<QtGui/QPainterPath>')
|
|
|
|
with open(filepath, 'w', encoding='utf-8') as f:
|
|
f.write(new_content)
|
|
|
|
files_fixed += 1
|
|
total_fixes += content.count('<QtCore/QPainterPath>')
|
|
print(f"Fixed: {filepath}")
|
|
|
|
except (PermissionError, OSError) as e:
|
|
# Skip files we can't access (build directories)
|
|
pass
|
|
|
|
print(f"\nFixed QPainterPath includes: {files_fixed} files, {total_fixes} total fixes")
|
|
return files_fixed, total_fixes
|
|
|
|
if __name__ == '__main__':
|
|
root_dir = sys.argv[1] if len(sys.argv) > 1 else '.'
|
|
fix_qpainterpath_includes(root_dir) |