使用CMake GUI设置交叉编译器文件 [英] Setting a cross-compiler file using the CMake GUI

查看:1144
本文介绍了使用CMake GUI设置交叉编译器文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用CMake设置交叉编译版本。到目前为止,我已经从命令行设置了像这样的交叉编译器文件CMake:

I'm trying set-up my cross-compile build using CMake. So far I'm setting the cross compiler file calling CMake like this from the command line:

#Call cmake with the given options
cmake -D CMAKE_TOOLCHAIN_FILE=$cross_cmp_file \
      -D BUILD_TESTS:BOOLEAN=$build_test \
      ../src 

这很好用。

现在,我尝试通过添加以下内容从GUI设置CMAKE_TOOLCHAIN_FILE变量:

Now I'm trying to set the CMAKE_TOOLCHAIN_FILE variable from the GUI by adding:

#CMAKE cross compiler file
set(CMAKE_TOOLCHAIN_FILE "Toolchain file" CACHE FILEPATH "../arm-crosscompile.cmake")

到我的CMakeLists.txt。

To my CMakeLists.txt.

这实际上在GUI中显示了该变量,但是当我按下配置按钮时,默认情况下,出现在CMAKE_CXX_COMPILER变量中的c ++编译器是该变量,而不是在工具链文件中指定的变量。

This actually shows the variable in the GUI but when I press the "Configure" button, the c++ compiler that appear in the CMAKE_CXX_COMPILER variable is the one by default and not the one specified in the toolchain file.

如何从Cmake-GUI设置工具链文件?

How can I set the toolchain file from the Cmake-GUI?

推荐答案

最后它。很简单。

第一次按下配置按钮时,将指定生成器参数,为项目选择任何生成器。然后选择选项指定要交叉编译的工具链文件 ,然后单击下一步:

The first time you press the "Configure" button you will get to specify the generator parameters, select any generator for your project. Then select the option "Specify toolchain file for cross-compiling" and click next:

单击下一步。在下面的对话框中,输入交叉编译文件的路径。

Click Next. In the following dialog, input the path to the cross-compilation file and you're done.

这篇关于使用CMake GUI设置交叉编译器文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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