Skip to content

[bug] 相对路径的 -iquote 未按项目根重写(与 -I 行为不一致) #226

Description

@Sunrisepeak

现象

[build].cflags/cxxflags 中的相对 -I 会被 mcpp 重写为项目根绝对路径(编译命令中可见),但 -iquote(推测 -isystem / -idirafter 同类)不做重写,按 ninja 构建目录解析,导致头文件静默找不到。

复现(mcpp 0.0.95, linux, gcc@16.1.0)

proj/
├── hdr/magic.h        # #define MAGIC 42
├── src/c.c            # #include "magic.h"
└── mcpp.toml
[build]
cflags = ["-iquotehdr"]

mcpp buildfatal error: magic.h: No such file or directory;换成 cflags = ["-Ihdr"] 则正常(命令行里已被绝对化)。

期望

include 族 flag(-I / -iquote / -isystem / -idirafter)的相对路径统一按项目根重写;或至少在文档标注"仅 -I 支持相对路径"。

背景

ffmpeg-m 打包时想用 -iquote 精确复刻上游"引号 include 搜库根、角括号不受影响"的语义(避免 -I<libavutil> 劫持 #include <time.h>),因该问题只能退回按上游范围收窄的 -I。踩坑记录见 mcpplibs/ffmpeg-m .agents/docs/2026-07-18-ffmpeg-m-implementation.md

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions