如何设置CMAKE_AR的选项? [英] How do I set the options for CMAKE_AR?
问题描述
我正在使用CMake进行交叉编译,一切正常,但是 CMAKE_AR 选项。
I'm doing cross compiling with CMake and all is OK but the CMAKE_AR options.
我使用设置(CMAKE_AR $ {GCC_PATH} / dld)
设置 CMAKE_AR 。但是我不知道如何设置它的选项。默认情况下,它使用选项 rc 创建档案。但是我需要将其更改为 -X -r5 -o
。使用 rc 时,它将抱怨找不到文件 rc 。
I use set(CMAKE_AR ${GCC_PATH}/dld)
to set CMAKE_AR. But I don't know how to set its option. By default, it uses the options rc to create the archive. But I need to change it to be -X -r5 -o
. When use rc, it will complain the file rc cannot be found.
我该如何解决? / p>
How do I fix it?
推荐答案
看来, crs标志已硬编码在用于创建档案的命令中。无法仅覆盖标志;您必须像这样重写整个命令:
It looks like the flags "crs" are hardcoded in the command for creating an archive. There's no way to override just the flags; you have to rewrite the whole command, like this:
SET(CMAKE_CXX_ARCHIVE_CREATE "<CMAKE_AR> -X -r5 -o <TARGET> <LINK_FLAGS> <OBJECTS>")
SET(CMAKE_C_ARCHIVE_CREATE "<CMAKE_AR> -X -r5 -o <TARGET> <LINK_FLAGS> <OBJECTS>")
当数字为 CMAKE_C_ARCHIVE_APPEND
(和CXX等价)时,的对象超过了命令行的最大值,它仅将 r标志传递给CMAKE_AR。您可能也需要更改它,请参见 https://cmake.org/ cmake / help / latest / variable / CMAKE_LANG_ARCHIVE_CREATE.html
There's also a CMAKE_C_ARCHIVE_APPEND
(and CXX equivalent) used when the number of objects exceeds the command line maximum, it passes just the "r" flag to CMAKE_AR. You may have to change that one too, see https://cmake.org/cmake/help/latest/variable/CMAKE_LANG_ARCHIVE_CREATE.html
这篇关于如何设置CMAKE_AR的选项?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!