fix: consider -fuse-ld

This commit is contained in:
Zhuo Yang 2024-09-11 22:03:33 +08:00
parent 9b874ad9b9
commit c42db7658e
1 changed files with 8 additions and 2 deletions

View File

@ -56,7 +56,13 @@ def parse_wmake_log(log_file):
# Determine if it's a compile or link statement # Determine if it's a compile or link statement
if '-Xlinker' in line or '-Wl,' in line: if '-Xlinker' in line or '-Wl,' in line:
# Link statement # Link statement
# Handle -fuse-ld
useld = re.search(r'(-fuse-ld=\S+)', line)
if useld:
link_options.append(f'{useld.group(1)}')
# Handle output file
output_file = re.search(r'-o\s+(\S+)', line).group(1) output_file = re.search(r'-o\s+(\S+)', line).group(1)
# Handle libraries
lib_matches = re.findall(r'-l(\S+)', line) lib_matches = re.findall(r'-l(\S+)', line)
for lib in lib_matches: for lib in lib_matches:
if lib not in link_libraries: if lib not in link_libraries:
@ -93,8 +99,8 @@ def parse_wmake_log(log_file):
objstr = f'add_library({objname} STATIC {" ".join(source_files)})' objstr = f'add_library({objname} STATIC {" ".join(source_files)})'
# Handle the issue of link and target having the same name # Handle the issue of link and target having the same name
link_libraries = [lib if lib != objname else f'lib{ link_libraries = [lib if lib != objname else f'lib{lib}.so'
lib}.so' for lib in link_libraries] for lib in link_libraries]
# Create CMakeLists.txt content # Create CMakeLists.txt content
cmake_content = f"""cmake_minimum_required(VERSION 3.10) cmake_content = f"""cmake_minimum_required(VERSION 3.10)