summaryrefslogtreecommitdiff
path: root/meta
diff options
context:
space:
mode:
authorKyle Russell <bkylerussell@gmail.com>2017-04-18 11:36:05 -0400
committerRichard Purdie <richard.purdie@linuxfoundation.org>2017-04-19 10:16:46 +0100
commitbd082c9be6191e67ea1b1bf10ce5e130a3433ab5 (patch)
tree646ccaf3cd3be9381070ada3adf3918c8c4acbba /meta
parentf5a1013ffa9815f22e13989e2bcb83f966e7ce2c (diff)
downloadopenembedded-core-bd082c9be6191e67ea1b1bf10ce5e130a3433ab5.tar.gz
openembedded-core-bd082c9be6191e67ea1b1bf10ce5e130a3433ab5.tar.bz2
openembedded-core-bd082c9be6191e67ea1b1bf10ce5e130a3433ab5.zip
cmake.bbclass: Set CMAKE_CROSSCOMPILING correctly
If CMAKE_SYSTEM_NAME is defined, CMake assumes we're cross-compiling, which is not necessarily the case. Signed-off-by: Kyle Russell <bkylerussell@gmail.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
Diffstat (limited to 'meta')
-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} )