]> code.ossystems Code Review - openembedded-core.git/commitdiff
cmake.bbclass: Set CMAKE_CROSSCOMPILING correctly
authorKyle Russell <bkylerussell@gmail.com>
Tue, 18 Apr 2017 15:36:05 +0000 (11:36 -0400)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Wed, 19 Apr 2017 09:16:46 +0000 (10:16 +0100)
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>
meta/classes/cmake.bbclass

index 9e7459929603056888efa596beb64059e50fe8a9..3f670919a843fcdd6d7899bfd76bfa7083874186 100644 (file)
@@ -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} )