如何设置CMAKE_AR的选项 [英] How to set the options for CMAKE_AR

查看:361
本文介绍了如何设置CMAKE_AR的选项的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用cmake进行交叉编译,一切正常,但 CMAKE_AR 选项。

I'm do cross compiling with cmake and all is OK but the CMAKE_AR options.

我使用 set(CMAKE_AR $ {GCC_PATH} / dld)可设置 CMAKE_AR 。但我不知道如何设置它的选项。默认情况下,它使用选项 rc 创建归档。但我需要将其更改为 -X -r5 -o

I use set(CMAKE_AR ${GCC_PATH}/dld) to set CMAKE_AR. But I don't know how to set its option. On default, it use the options rc to create archive. But I need to change it to be -X -r5 -o. When use rc, it will complaint the file rc cannot be found.

如何解决? p>

How to fix it?

推荐答案

看起来像在创建归档的命令中的标志cr是硬编码的。没有办法只覆盖标志,你必须重写整个命令,像这样:

Looks like the flags "cr" 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。您可能还需要更改那个。

There's also a CMAKE_C_ARCHIVE_APPEND (and CXX equivalent) that passes just the "r" flag to CMAKE_AR. You may have to change that one too.

这篇关于如何设置CMAKE_AR的选项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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