summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--meta/classes/cmake.bbclass4
1 files changed, 4 insertions, 0 deletions
diff --git a/meta/classes/cmake.bbclass b/meta/classes/cmake.bbclass
index 9e74599296..3f670919a8 100644
--- a/meta/classes/cmake.bbclass
+++ b/meta/classes/cmake.bbclass
@@ -42,9 +42,13 @@ def map_target_arch_to_uname_arch(target_arch):
return target_arch
cmake_do_generate_toolchain_file() {
+ if [ "${BUILD_SYS}" = "${HOST_SYS}" ]; then
+ CMAKE_CROSSCOMPILING="set( CMAKE_CROSSCOMPILING FALSE )"
+ fi
cat > ${WORKDIR}/toolchain.cmake <<EOF
# CMake system name must be something like "Linux".
# This is important for cross-compiling.
+${CMAKE_CROSSCOMPILING}
set( CMAKE_SYSTEM_NAME `echo ${TARGET_OS} | sed -e 's/^./\u&/' -e 's/^\(Linux\).*/\1/'` )
set( CMAKE_SYSTEM_PROCESSOR ${@map_target_arch_to_uname_arch(d.getVar('TARGET_ARCH'))} )
set( CMAKE_C_COMPILER ${OECMAKE_C_COMPILER} )