[英]How should I use ccache if the compiler absolute path is hard-coded in the makefile?
It's not an option for me to modify the complicated nest of makefiles that builds our code, and in various places they construct absolute paths to very specific compilers, eg /home/arm2gcc/gcc-arm-none-eabi-8-2018-q4-major/bin/arm-none-eabi-gcc
修改构建我们代码的复杂的 makefile 嵌套对我来说不是一个选项,并且在不同的地方他们构建了非常特定的编译器的绝对路径,例如
/home/arm2gcc/gcc-arm-none-eabi-8-2018-q4-major/bin/arm-none-eabi-gcc
That makes it hard to use ccache either as a prefix or by putting it first in the path.这使得很难将 ccache 用作前缀或将其放在路径中的首位。
So I wonder about moving the compiler installations on my personal machine to eg /home/arm2gcc-real
and putting fake scripts in /home/arm2gcc
that redirect to the real compilers.所以我想知道将我个人机器上的编译器安装移动到例如
/home/arm2gcc-real
并将假脚本放入重定向到真实编译器的/home/arm2gcc
中。
Can anyone suggest how to do this?谁能建议如何做到这一点? Or is there a better way?
或者,还有更好的方法?
Disclaimer: I've only limited experience with Ccache and CMake.免责声明:我对 Ccache 和 CMake 的经验有限。
Can you try adding this in the root CMakeLists.txt file:您可以尝试将其添加到根 CMakeLists.txt 文件中吗:
find_program(CCACHE ccache)
if(CCACHE)
set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ${CCACHE})
endif()
If that does not work, I think we may need some more info on how the compilers are setup exactly in your CMakeLists.txt files.如果这不起作用,我认为我们可能需要更多关于如何在 CMakeLists.txt 文件中准确设置编译器的信息。
I suggest:我建议:
mv .../bin/arm-none-eabi-gcc .../bin/arm-none-eabi-gcc.real
Then, create a script to replace .../bin/arm-none-eabi-gcc
with this content:然后,创建一个脚本以将
.../bin/arm-none-eabi-gcc
替换为以下内容:
#!/bin/sh
exec ccache ${0}.real "$@"
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.