summaryrefslogtreecommitdiffstats
path: root/meta/classes
diff options
context:
space:
mode:
authorPhilippe Normand <philn@igalia.com>2019-05-29 09:40:42 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2019-05-30 12:37:03 +0100
commita13288fd507870d4a7bcf2a6a5069bd4555e548b (patch)
tree2bb04c0eb41d1d0f5844fcbca0f2568036e6b173 /meta/classes
parente9e7102fe2edb0c55d64043e5eb050fbee5f4445 (diff)
downloadpoky-a13288fd507870d4a7bcf2a6a5069bd4555e548b.tar.gz
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>
Diffstat (limited to 'meta/classes')
-rw-r--r--meta/classes/cmake.bbclass11
1 files changed, 9 insertions, 2 deletions
diff --git a/meta/classes/cmake.bbclass b/meta/classes/cmake.bbclass
index d3f0d70847..a5cffedbc6 100644
--- a/meta/classes/cmake.bbclass
+++ b/meta/classes/cmake.bbclass
@@ -26,14 +26,16 @@ python() {
26 if not d.getVar('OECMAKE_C_COMPILER'): 26 if not d.getVar('OECMAKE_C_COMPILER'):
27 cc_list = d.getVar('CC').split() 27 cc_list = d.getVar('CC').split()
28 if cc_list[0] == 'ccache': 28 if cc_list[0] == 'ccache':
29 d.setVar('OECMAKE_C_COMPILER', '%s %s' % (cc_list[0], cc_list[1])) 29 d.setVar('OECMAKE_C_COMPILER_LAUNCHER', cc_list[0])
30 d.setVar('OECMAKE_C_COMPILER', cc_list[1])
30 else: 31 else:
31 d.setVar('OECMAKE_C_COMPILER', cc_list[0]) 32 d.setVar('OECMAKE_C_COMPILER', cc_list[0])
32 33
33 if not d.getVar('OECMAKE_CXX_COMPILER'): 34 if not d.getVar('OECMAKE_CXX_COMPILER'):
34 cxx_list = d.getVar('CXX').split() 35 cxx_list = d.getVar('CXX').split()
35 if cxx_list[0] == 'ccache': 36 if cxx_list[0] == 'ccache':
36 d.setVar('OECMAKE_CXX_COMPILER', '%s %s' % (cxx_list[0], cxx_list[1])) 37 d.setVar('OECMAKE_CXX_COMPILER_LAUNCHER', cxx_list[0])
38 d.setVar('OECMAKE_CXX_COMPILER', cxx_list[1])
37 else: 39 else:
38 d.setVar('OECMAKE_CXX_COMPILER', cxx_list[0]) 40 d.setVar('OECMAKE_CXX_COMPILER', cxx_list[0])
39} 41}
@@ -49,6 +51,9 @@ OECMAKE_CXX_LINK_FLAGS ?= "${HOST_CC_ARCH} ${TOOLCHAIN_OPTIONS} ${CXXFLAGS} ${LD
49CXXFLAGS += "${HOST_CC_ARCH} ${TOOLCHAIN_OPTIONS}" 51CXXFLAGS += "${HOST_CC_ARCH} ${TOOLCHAIN_OPTIONS}"
50CFLAGS += "${HOST_CC_ARCH} ${TOOLCHAIN_OPTIONS}" 52CFLAGS += "${HOST_CC_ARCH} ${TOOLCHAIN_OPTIONS}"
51 53
54OECMAKE_C_COMPILER_LAUNCHER ?= ""
55OECMAKE_CXX_COMPILER_LAUNCHER ?= ""
56
52OECMAKE_RPATH ?= "" 57OECMAKE_RPATH ?= ""
53OECMAKE_PERLNATIVE_DIR ??= "" 58OECMAKE_PERLNATIVE_DIR ??= ""
54OECMAKE_EXTRA_ROOT_PATH ?= "" 59OECMAKE_EXTRA_ROOT_PATH ?= ""
@@ -86,6 +91,8 @@ set( CMAKE_SYSTEM_NAME `echo ${TARGET_OS} | sed -e 's/^./\u&/' -e 's/^\(Linux\).
86set( CMAKE_SYSTEM_PROCESSOR ${@map_target_arch_to_uname_arch(d.getVar('TARGET_ARCH'))} ) 91set( CMAKE_SYSTEM_PROCESSOR ${@map_target_arch_to_uname_arch(d.getVar('TARGET_ARCH'))} )
87set( CMAKE_C_COMPILER ${OECMAKE_C_COMPILER} ) 92set( CMAKE_C_COMPILER ${OECMAKE_C_COMPILER} )
88set( CMAKE_CXX_COMPILER ${OECMAKE_CXX_COMPILER} ) 93set( CMAKE_CXX_COMPILER ${OECMAKE_CXX_COMPILER} )
94set( CMAKE_C_COMPILER_LAUNCHER ${OECMAKE_C_COMPILER_LAUNCHER} )
95set( CMAKE_CXX_COMPILER_LAUNCHER ${OECMAKE_CXX_COMPILER_LAUNCHER} )
89set( CMAKE_ASM_COMPILER ${OECMAKE_C_COMPILER} ) 96set( CMAKE_ASM_COMPILER ${OECMAKE_C_COMPILER} )
90set( CMAKE_AR ${OECMAKE_AR} CACHE FILEPATH "Archiver" ) 97set( CMAKE_AR ${OECMAKE_AR} CACHE FILEPATH "Archiver" )
91set( CMAKE_C_FLAGS "${OECMAKE_C_FLAGS}" CACHE STRING "CFLAGS" ) 98set( CMAKE_C_FLAGS "${OECMAKE_C_FLAGS}" CACHE STRING "CFLAGS" )