mirror of
https://git.yoctoproject.org/poky
synced 2026-04-21 03:32:12 +02:00
cmake: Use compiler launcher variable when ccache is enabled
Setting the CMAKE_C{,XX}_COMPILER_LAUNCHER variables is the recomended way to
deal with ccache in CMake. It allows build scripts to optionally opt-out of
ccache, which is especially useful when the pre-processed GCC output is required.
(From OE-Core rev: 0a36d1b342c0b4760bc75794c2e941a17012bc19)
Signed-off-by: Philippe Normand <philn@igalia.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
committed by
Richard Purdie
parent
e9e7102fe2
commit
a13288fd50
@@ -26,14 +26,16 @@ python() {
|
||||
if not d.getVar('OECMAKE_C_COMPILER'):
|
||||
cc_list = d.getVar('CC').split()
|
||||
if cc_list[0] == 'ccache':
|
||||
d.setVar('OECMAKE_C_COMPILER', '%s %s' % (cc_list[0], cc_list[1]))
|
||||
d.setVar('OECMAKE_C_COMPILER_LAUNCHER', cc_list[0])
|
||||
d.setVar('OECMAKE_C_COMPILER', cc_list[1])
|
||||
else:
|
||||
d.setVar('OECMAKE_C_COMPILER', cc_list[0])
|
||||
|
||||
if not d.getVar('OECMAKE_CXX_COMPILER'):
|
||||
cxx_list = d.getVar('CXX').split()
|
||||
if cxx_list[0] == 'ccache':
|
||||
d.setVar('OECMAKE_CXX_COMPILER', '%s %s' % (cxx_list[0], cxx_list[1]))
|
||||
d.setVar('OECMAKE_CXX_COMPILER_LAUNCHER', cxx_list[0])
|
||||
d.setVar('OECMAKE_CXX_COMPILER', cxx_list[1])
|
||||
else:
|
||||
d.setVar('OECMAKE_CXX_COMPILER', cxx_list[0])
|
||||
}
|
||||
@@ -49,6 +51,9 @@ OECMAKE_CXX_LINK_FLAGS ?= "${HOST_CC_ARCH} ${TOOLCHAIN_OPTIONS} ${CXXFLAGS} ${LD
|
||||
CXXFLAGS += "${HOST_CC_ARCH} ${TOOLCHAIN_OPTIONS}"
|
||||
CFLAGS += "${HOST_CC_ARCH} ${TOOLCHAIN_OPTIONS}"
|
||||
|
||||
OECMAKE_C_COMPILER_LAUNCHER ?= ""
|
||||
OECMAKE_CXX_COMPILER_LAUNCHER ?= ""
|
||||
|
||||
OECMAKE_RPATH ?= ""
|
||||
OECMAKE_PERLNATIVE_DIR ??= ""
|
||||
OECMAKE_EXTRA_ROOT_PATH ?= ""
|
||||
@@ -86,6 +91,8 @@ set( CMAKE_SYSTEM_NAME `echo ${TARGET_OS} | sed -e 's/^./\u&/' -e 's/^\(Linux\).
|
||||
set( CMAKE_SYSTEM_PROCESSOR ${@map_target_arch_to_uname_arch(d.getVar('TARGET_ARCH'))} )
|
||||
set( CMAKE_C_COMPILER ${OECMAKE_C_COMPILER} )
|
||||
set( CMAKE_CXX_COMPILER ${OECMAKE_CXX_COMPILER} )
|
||||
set( CMAKE_C_COMPILER_LAUNCHER ${OECMAKE_C_COMPILER_LAUNCHER} )
|
||||
set( CMAKE_CXX_COMPILER_LAUNCHER ${OECMAKE_CXX_COMPILER_LAUNCHER} )
|
||||
set( CMAKE_ASM_COMPILER ${OECMAKE_C_COMPILER} )
|
||||
set( CMAKE_AR ${OECMAKE_AR} CACHE FILEPATH "Archiver" )
|
||||
set( CMAKE_C_FLAGS "${OECMAKE_C_FLAGS}" CACHE STRING "CFLAGS" )
|
||||
|
||||
Reference in New Issue
Block a user