diff options
author | Philippe Normand <philn@igalia.com> | 2019-05-29 09:40:42 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2019-05-30 12:37:03 +0100 |
commit | a13288fd507870d4a7bcf2a6a5069bd4555e548b (patch) | |
tree | 2bb04c0eb41d1d0f5844fcbca0f2568036e6b173 | |
parent | e9e7102fe2edb0c55d64043e5eb050fbee5f4445 (diff) | |
download | poky-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>
-rw-r--r-- | meta/classes/cmake.bbclass | 11 |
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 | |||
49 | CXXFLAGS += "${HOST_CC_ARCH} ${TOOLCHAIN_OPTIONS}" | 51 | CXXFLAGS += "${HOST_CC_ARCH} ${TOOLCHAIN_OPTIONS}" |
50 | CFLAGS += "${HOST_CC_ARCH} ${TOOLCHAIN_OPTIONS}" | 52 | CFLAGS += "${HOST_CC_ARCH} ${TOOLCHAIN_OPTIONS}" |
51 | 53 | ||
54 | OECMAKE_C_COMPILER_LAUNCHER ?= "" | ||
55 | OECMAKE_CXX_COMPILER_LAUNCHER ?= "" | ||
56 | |||
52 | OECMAKE_RPATH ?= "" | 57 | OECMAKE_RPATH ?= "" |
53 | OECMAKE_PERLNATIVE_DIR ??= "" | 58 | OECMAKE_PERLNATIVE_DIR ??= "" |
54 | OECMAKE_EXTRA_ROOT_PATH ?= "" | 59 | OECMAKE_EXTRA_ROOT_PATH ?= "" |
@@ -86,6 +91,8 @@ set( CMAKE_SYSTEM_NAME `echo ${TARGET_OS} | sed -e 's/^./\u&/' -e 's/^\(Linux\). | |||
86 | set( CMAKE_SYSTEM_PROCESSOR ${@map_target_arch_to_uname_arch(d.getVar('TARGET_ARCH'))} ) | 91 | set( CMAKE_SYSTEM_PROCESSOR ${@map_target_arch_to_uname_arch(d.getVar('TARGET_ARCH'))} ) |
87 | set( CMAKE_C_COMPILER ${OECMAKE_C_COMPILER} ) | 92 | set( CMAKE_C_COMPILER ${OECMAKE_C_COMPILER} ) |
88 | set( CMAKE_CXX_COMPILER ${OECMAKE_CXX_COMPILER} ) | 93 | set( CMAKE_CXX_COMPILER ${OECMAKE_CXX_COMPILER} ) |
94 | set( CMAKE_C_COMPILER_LAUNCHER ${OECMAKE_C_COMPILER_LAUNCHER} ) | ||
95 | set( CMAKE_CXX_COMPILER_LAUNCHER ${OECMAKE_CXX_COMPILER_LAUNCHER} ) | ||
89 | set( CMAKE_ASM_COMPILER ${OECMAKE_C_COMPILER} ) | 96 | set( CMAKE_ASM_COMPILER ${OECMAKE_C_COMPILER} ) |
90 | set( CMAKE_AR ${OECMAKE_AR} CACHE FILEPATH "Archiver" ) | 97 | set( CMAKE_AR ${OECMAKE_AR} CACHE FILEPATH "Archiver" ) |
91 | set( CMAKE_C_FLAGS "${OECMAKE_C_FLAGS}" CACHE STRING "CFLAGS" ) | 98 | set( CMAKE_C_FLAGS "${OECMAKE_C_FLAGS}" CACHE STRING "CFLAGS" ) |