gpt4 book ai didi

c++ - CMake + ccache : RULE_LAUNCH_COMPILE or CMAKE__COMPILER_LAUNCHER

转载 作者:行者123 更新时间:2023-12-03 07:15:29 34 4
gpt4 key购买 nike

在 CMake 中使用 ccache 时,似乎有两种设置项目的方法。
第一个是 RULE_LAUNCH_COMPILE

find_program(CCACHE "ccache")
if(CCACHE)
set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE "${CCACHE}")
endif()
第二个是 CMAKE_<LANG>_COMPILER_LAUNCHER :
find_program(CCACHE "ccache")
if(CCACHE)
set(CMAKE_C_COMPILER_LAUNCHER ${CCACHE})
set(CMAKE_CXX_COMPILER_LAUNCHER ${CCACHE})
endif(CCACHE)
哪一种被认为是最佳实践? :)
谢谢你的帮助。

最佳答案

第一个将对构建中的所有语言使用启动器。第二个将使用相同的启动器 CCXX但不适用于其他语言。这两种方法略有不同,因为第二种方法允许针对不同语言使用不同的启动器。第二种方法允许更精细的控制并且可能是优选的。还有用于控制哪些项目使用启动器的环境变量以及目录和目标属性。
https://crascit.com/2016/04/09/using-ccache-with-cmake/

关于c++ - CMake + ccache : RULE_LAUNCH_COMPILE or CMAKE_<LANG>_COMPILER_LAUNCHER,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64592095/

34 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com