summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--meta/classes/cmake.bbclass12
1 files changed, 11 insertions, 1 deletions
diff --git a/meta/classes/cmake.bbclass b/meta/classes/cmake.bbclass
index c1742461ab..ae3cc025e8 100644
--- a/meta/classes/cmake.bbclass
+++ b/meta/classes/cmake.bbclass
@@ -30,12 +30,22 @@ OECMAKE_EXTRA_ROOT_PATH ?= ""
30OECMAKE_FIND_ROOT_PATH_MODE_PROGRAM = "ONLY" 30OECMAKE_FIND_ROOT_PATH_MODE_PROGRAM = "ONLY"
31OECMAKE_FIND_ROOT_PATH_MODE_PROGRAM_class-native = "BOTH" 31OECMAKE_FIND_ROOT_PATH_MODE_PROGRAM_class-native = "BOTH"
32 32
33# CMake expects target architectures in the format of uname(2),
34# which do not always match TARGET_ARCH, so all the necessary
35# conversions should happen here.
36def map_target_arch_to_uname_arch(target_arch):
37 if target_arch == "powerpc":
38 return "ppc"
39 if target_arch == "powerpc64":
40 return "ppc64"
41 return target_arch
42
33cmake_do_generate_toolchain_file() { 43cmake_do_generate_toolchain_file() {
34 cat > ${WORKDIR}/toolchain.cmake <<EOF 44 cat > ${WORKDIR}/toolchain.cmake <<EOF
35# CMake system name must be something like "Linux". 45# CMake system name must be something like "Linux".
36# This is important for cross-compiling. 46# This is important for cross-compiling.
37set( CMAKE_SYSTEM_NAME `echo ${TARGET_OS} | sed -e 's/^./\u&/' -e 's/^\(Linux\).*/\1/'` ) 47set( CMAKE_SYSTEM_NAME `echo ${TARGET_OS} | sed -e 's/^./\u&/' -e 's/^\(Linux\).*/\1/'` )
38set( CMAKE_SYSTEM_PROCESSOR ${TARGET_ARCH} ) 48set( CMAKE_SYSTEM_PROCESSOR ${@map_target_arch_to_uname_arch(d.getVar('TARGET_ARCH', True))} )
39set( CMAKE_C_COMPILER ${OECMAKE_C_COMPILER} ) 49set( CMAKE_C_COMPILER ${OECMAKE_C_COMPILER} )
40set( CMAKE_CXX_COMPILER ${OECMAKE_CXX_COMPILER} ) 50set( CMAKE_CXX_COMPILER ${OECMAKE_CXX_COMPILER} )
41set( CMAKE_ASM_COMPILER ${OECMAKE_C_COMPILER} ) 51set( CMAKE_ASM_COMPILER ${OECMAKE_C_COMPILER} )