[oe-commits] [openembedded-core] 11/18: cmake: Use compiler launcher variable when ccache is enabled

git at git.openembedded.org git at git.openembedded.org
Wed May 29 21:06:45 UTC 2019


This is an automated email from the git hooks/post-receive script.

rpurdie pushed a commit to branch master-next
in repository openembedded-core.

commit 43d39bba339fc781b5a4eb0b7a48171aeeda8fef
Author: Philippe Normand <philn at igalia.com>
AuthorDate: Wed May 29 09:40:42 2019 +0100

    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.
    
    Signed-off-by: Philippe Normand <philn at igalia.com>
    Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>
---
 meta/classes/cmake.bbclass | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/meta/classes/cmake.bbclass b/meta/classes/cmake.bbclass
index d3f0d70..a5cffed 100644
--- a/meta/classes/cmake.bbclass
+++ b/meta/classes/cmake.bbclass
@@ -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" )

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Openembedded-commits mailing list