English 中文(简体)
选择 cm合未来选择(CROSS_COMPILE)
原标题:Pass option to cmake for future option to crosscompilation (CROSS_COMPILE)
IF(UNIX)
    # CROSS COMPILATION! ON/OFF
    #SET(CMAKE_C_COMPILER   /home/username/projects/buildroot/output/host/usr/bin/arm-linux-gcc)
    #SET(CMAKE_CXX_COMPILER /home/username/projects/buildroot/output/host/usr/bin/arm-linux-g++)
    #SET(CMAKE_C_COMPILER   /home/username/CodeSourcery/Sourcery_G++_Lite/bin/arm-none-eabi-gcc)
    #SET(CMAKE_CXX_COMPILER /home/username/CodeSourcery/Sourcery_G++_Lite/bin/arm-none-eabi-g++)

这里是我现在对相互交织所做的事。 我也想补充以下选择:

make CROSS_COMPILE=~/projects/buildroot/output/host/usr/bin/arm-linux-

如果我不走CROSS-COMPILE来做(而不是打碎)的话,那么它必须使用系统缺漏,这样一来就必须走这个选择,来做陈述。 我如何能够做到这一点?

最佳回答

“建筑”为你制作了一个CMake工具链文件。 视您的建筑设计而定,它可能直接载于<编码>产出>/编码>目录,或载于<编码>产出/东道/共享/buildroot。 文档名称为toolchainfile.cmake。 接着,建设你的CMake应用,就是:

cmake -DCMAKE_TOOLCHAIN_FILE=/path/to/buildroot/output/host/usr/comm/buildroot/toolchainfile.cmake

档案中包含所有关于交织路线、kg类环境变量、头目和图书馆所在地等的定义。

问题回答

对于最简单的方法,应:

SET(CMAKE_C_COMPILER   $(CROSS_COMPILE)gcc)
SET(CMAKE_CXX_COMPILER $(CROSS_COMPILE)g++)

当CROSS-COMPILE变量获得通过时,将代之以交叉汇编途径。

现在是正确的途径。 理想的情况是,在管理CMake时,应当界定CROSS-COMPILE变量,因为它意在形成交叉形状。 如果使用其他电离层发动机,则使用第一种解决办法可能会中断。

这可以做到:

IF(UNIX)
    SET(CMAKE_C_COMPILER   ${CROSS_COMPILE}gcc)
    SET(CMAKE_CXX_COMPILER ${CROSS_COMPILE}g++)

然后界定变量:

cmake -G "Unix Makefiles" -DCROSS_COMPILE=~/projects/buildroot/output/host/usr/bin/arm-linux-

在这种情况下,CMake将根据是否界定了CROSS-COMPILE生成适当的建筑档案。





相关问题
makefile: how to show line numbers for debugging?

Is there a way to have make display the line number where it declares an error? The -d switch doesn t seem to cut it. Updated: Example output: Reaping winning child 0x08aa8648 PID 9381 /bin/sh: ...

What is the reasoning behind the Makefile whitespace syntax?

I m revisiting Python after Michael Sparks s excellent walk through of Peter Norvig s Python spell checker at the SO DevDay in London. One of the points he highlighted was how clean Python is to look ...

Debugging GNU make

Is there a command line way in make to find out which of the prerequisites of a target is not updated?

How to add an all rule to this Makefile?

I want to just type make all and have the following Makefile do everything it s supposed to do: LEX = lex YACC = yacc CC = gcc calcu: y.tab.o lex.yy.o $(CC) -o calcu y.tab.o lex.yy.o -ly -lfl ...

How to discover number of *logical* cores on Mac OS X?

How can you tell, from the command line, how many cores are on the machine when you re running Mac OS X? On Linux, I use: x=$(awk /^processor/ {++n} END {print n+1} /proc/cpuinfo) It s not ...

Using extern in C doesn t work as expected

I have created two files: tunables.h #ifndef TUNABLES_H #define TUNABLES_H void tunables_load_conservative(); void tunables_load_aggressive(); extern int timer_x; #endif /*TUNABLES_H */ and ...

热门标签