How to Use CCache with CMake?

前端 未结 8 728
陌清茗
陌清茗 2020-12-02 09:32

I would like to do the following: If CCache is present in PATH, use \"ccache g++\" for compilation, else use g++. I tried writing a small my-cmake script containing

8条回答
  •  [愿得一人]
    2020-12-02 10:15

    I verified the following works (source: this link):

            CC="gcc" CXX="g++" cmake -D CMAKE_CXX_COMPILER="ccache" -D CMAKE_CXX_COMPILER_ARG1="g++" -D CMAKE_C_COMPILER="ccache" -D CMAKE_C_COMPILER_ARG1="gcc" $*
    

    Update: I later realized that even this does not work. Strangely it works every alternate time (the other times cmake complains).

提交回复
热议问题