You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

CMake在Azure Pipeline中混淆-S与-B参数:源目录与构建目录异常

Azure Pipeline中CMake执行异常问题

在Azure Pipeline中运行CMake时出现异常,已开启set -o xtrace打印实际执行命令,输出如下:

+ cmake -S /home/user/myagent/_work/86/s/repo -B /home/user/myagent/_work/86/b/build_image_builder -DCMAKE_INSTALL_PREFIX=/home/rfmibuild/myagent/_work/86/b/prefix
CMake Error: The source directory "/home/user/myagent/_work/86/b/build_image_builder" does not exist.
Specify --help for usage, or press the help button on the CMake GUI.

(注:为清晰起见已移除额外CMake参数,路径名称略有调整)

可见CMake忽略了-S指定的源目录,错误地将-B指定的构建目录当作源目录处理。

若预先手动创建构建目录,错误信息变为:

+ cmake -S /home/user/myagent/_work/840/s/repo -B /home/user/myagent/_work/840/b/build_image_builder -DCMAKE_INSTALL_PREFIX=/home/user/myagent/_work/840/b/prefix
CMake Error: The source directory "/home/user/myagent/_work/840/b/build_image_builder" does not appear to contain CMakeLists.txt.
Specify --help for usage, or press the help button on the CMake GUI.

此前在Azure Pipeline中运行CMake未出现该问题,怀疑由流水线配置变化导致,但无法定位具体原因。已尝试以下解决方法:

  • 移除-S参数直接指定源目录,问题依旧;
  • 移除-B参数:可正常识别源目录,但无法控制二进制文件输出目录。

内容的提问来源于stack exchange,提问作者mbr0wn

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.30 03:09:53