CMake:指定构建工具链 [英] CMake: specifying build toolchain

查看:763
本文介绍了CMake:指定构建工具链的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

CMake非常新,到目前为止,我发现它非常有帮助。我有一套自定义库,我想使用交叉编译为多个平台构建。安装工具链,我可以手工创建 Makefile ,我需要这样做,但我想能够使用CMake。



有没有办法告诉 cmake 哪个工具链要使用,无论是在命令行还是在

www.vtk.org/Wiki/CMake_Cross_Compiling\">在这里:基本上,你定义一个工具链文件,设置的东西像系统名称,路径编译器等。然后调用 cmake

  cmake / path / src -DCMAKE_TOOLCHAIN_FILE = / path / to / toolchain / foo-bar-baz.cmake 


Very new to CMake, and so far I'm finding it to be extremely helpful. I have a set of custom libraries that I would like to build for multiple platforms using cross-compilation. The toolchains are installed, and I can hand-create the Makefiles that I need to do so, but I would like to be able to make use of CMake.

Is there a way to tell cmake which toolchain to use, either at the command line or in the CMakeLists.txt file?

解决方案

Have a look here: basically, you define a "toolchain file" that sets things like the system name, paths to compilers and so on. You then call cmake like so:

cmake /path/to/src -DCMAKE_TOOLCHAIN_FILE=/path/to/toolchain/foo-bar-baz.cmake

这篇关于CMake:指定构建工具链的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆