diff options
-rw-r--r-- | meta/classes/cmake.bbclass | 12 |
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 ?= "" | |||
30 | OECMAKE_FIND_ROOT_PATH_MODE_PROGRAM = "ONLY" | 30 | OECMAKE_FIND_ROOT_PATH_MODE_PROGRAM = "ONLY" |
31 | OECMAKE_FIND_ROOT_PATH_MODE_PROGRAM_class-native = "BOTH" | 31 | OECMAKE_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. | ||
36 | def 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 | |||
33 | cmake_do_generate_toolchain_file() { | 43 | cmake_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. |
37 | set( CMAKE_SYSTEM_NAME `echo ${TARGET_OS} | sed -e 's/^./\u&/' -e 's/^\(Linux\).*/\1/'` ) | 47 | set( CMAKE_SYSTEM_NAME `echo ${TARGET_OS} | sed -e 's/^./\u&/' -e 's/^\(Linux\).*/\1/'` ) |
38 | set( CMAKE_SYSTEM_PROCESSOR ${TARGET_ARCH} ) | 48 | set( CMAKE_SYSTEM_PROCESSOR ${@map_target_arch_to_uname_arch(d.getVar('TARGET_ARCH', True))} ) |
39 | set( CMAKE_C_COMPILER ${OECMAKE_C_COMPILER} ) | 49 | set( CMAKE_C_COMPILER ${OECMAKE_C_COMPILER} ) |
40 | set( CMAKE_CXX_COMPILER ${OECMAKE_CXX_COMPILER} ) | 50 | set( CMAKE_CXX_COMPILER ${OECMAKE_CXX_COMPILER} ) |
41 | set( CMAKE_ASM_COMPILER ${OECMAKE_C_COMPILER} ) | 51 | set( CMAKE_ASM_COMPILER ${OECMAKE_C_COMPILER} ) |