我们可以在柯南中使用介子构建系统。但我找不到任何有关如何在 meson.build 中添加 conan 包作为依赖项的文档。在cmake中非常简单,我们可以简单地使用conan_cmake_run。我怎样才能在介子中做类似的事情?
小智 2
由于介子还不支持柯南,所以我们需要自己桥接它们。幸运的是它很简单,一个例子:
conan_pkgs= {
'fmt':'fmt/5.3.0@', # <- Must contain @, otherwise Conan will think it is a path
# you can add more ...
}
deps=[]
foreach pkg_name, conan_ref : conan_pkgs
module_path = meson.current_build_dir() / 'conan-cmake' / pkg_name
run_command('conan','install',conan_ref, '-if',module_path,
'-g','cmake_find_package', check: true)
deps += dependency(pkg_name, method: 'cmake', cmake_module_path: module_path)
endforeach
executable('exe_need_deps', ['main.cpp'],
dependencies: deps
)
Run Code Online (Sandbox Code Playgroud)
参考:这个要点
| 归档时间: |
|
| 查看次数: |
2579 次 |
| 最近记录: |