避免cmake在MacOS中添加标志-search_paths_first和-headerpad_max_install_names [英] Avoid cmake to add the flags -search_paths_first and -headerpad_max_install_names in MacOS
问题描述
我正在使用cmake
在MacOS中为ARM
构建*.elf
文件. CMake
将自动添加标志-Wl,-search_paths_first -Wl,-headerpad_max_install_name
,这将导致生成无效的*.elf
文件.我收到错误warning: cannot find entry symbol arch_paths_first; defaulting to 00000000080001e0
.
I'm building an *.elf
file for ARM
within MacOS using cmake
. CMake
is adding the flags -Wl,-search_paths_first -Wl,-headerpad_max_install_name
automatically, which leads to produce an invalid *.elf
file. I obtain the error warning: cannot find entry symbol arch_paths_first; defaulting to 00000000080001e0
.
我试图在不使用该选项的情况下执行arm gcc命令,并且效果很好.
I have tried to execute the arm gcc command without that options and it works perfectly.
如何停止cmake
添加这些标志?
How can I stop cmake
to add these flags?
推荐答案
我找到了一种方法.
有必要添加以下指令:
set(HAVE_FLAG_SEARCH_PATHS_FIRST 0)
我很确定必须在project
指令之前添加它.
I'm pretty sure that it must be added before the project
directive.
为了删除标志-headerpad_max_install_names
,我在project
指令后写了以下内容:
For removing the flag -headerpad_max_install_names
, I have written the following after the project
directive:
set(CMAKE_C_LINK_FLAGS "")
我想如果我正在使用g++
,我应该添加
I guess that if I were using g++
I should needed to add
set(CMAKE_CXX_LINK_FLAGS "")
这篇关于避免cmake在MacOS中添加标志-search_paths_first和-headerpad_max_install_names的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!