Make sure ccache is considered as part of the CMake build

Summary:
I've just realized that CMake is ignoring `ccache`, even if you have it
installed. This is the necessary change needed to verify if the user
has `ccache` installed and eventually use it.

While not a necessary change for Prefab supprot, this is a nice to have
that I've discovered while working on it.

Changelog:
[Internal] [Changed] - Make sure ccache is considered as part of the CMake build

Reviewed By: cipolleschi

Differential Revision: D39815089

fbshipit-source-id: be62e5fe98954593fd907ec21c41950a967cff04
This commit is contained in:
Nicola Corti 2022-09-26 08:48:04 -07:00 коммит произвёл Facebook GitHub Bot
Родитель 61e82aa462
Коммит bf55a3a392
2 изменённых файлов: 15 добавлений и 0 удалений

Просмотреть файл

@ -12,10 +12,18 @@
# - Include all the pre-built libraries in your build graph
# - Link your library against those prebuilt libraries so you can access JSI, Fabric, etc.
# - Link your library against any autolinked library.
# - Make sure ccache is used as part of the compilation process, if you have it installed.
cmake_minimum_required(VERSION 3.13)
set(CMAKE_VERBOSE_MAKEFILE on)
# If you have ccache installed, we're going to honor it.
find_program(CCACHE_FOUND ccache)
if(CCACHE_FOUND)
set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ccache)
set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK ccache)
endif(CCACHE_FOUND)
include(${REACT_ANDROID_DIR}/cmake-utils/Android-prebuilt.cmake)
file(GLOB input_SRC CONFIGURE_DEPENDS

Просмотреть файл

@ -8,6 +8,13 @@ set(CMAKE_VERBOSE_MAKEFILE on)
project(ReactAndroid)
# If you have ccache installed, we're going to honor it.
find_program(CCACHE_FOUND ccache)
if(CCACHE_FOUND)
set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ccache)
set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK ccache)
endif(CCACHE_FOUND)
# Make sure every shared lib includes a .note.gnu.build-id header
add_link_options(-Wl,--build-id)
add_compile_options(-Wall -Werror -std=c++1y)