using EXTRA_OECMAKE doesn't have any effect in cmake variable in bitbake recipe

元气小坏坏 提交于 2021-01-27 12:05:34

问题


I wanted to add my application in a yocto Image and I used this recipe:

DESCRIPTION = "my application" 
SECTION = "examples" 
LICENSE = "CLOSED" 
PR = "r0" 

DEPENDS += "opencv"

SRC_URI = "git://address/to/myApplication.git;protocol=https;tag=v0.1"

inherit pkgconfig cmake

after running bitbake my-application, I faced this error:

fatal error: string: No such file or directory #include <string>

I searched on the internet and I found that I need to pass this variable to my CMake in my recipe:

EXTRA_OECMAKE += "-DCMAKE_NO_SYSTEM_FROM_IMPORTED=ON"

but nothing had changed. again I faced the error. then I decided to add the variable to my CMake:

set(CMAKE_NO_SYSTEM_FROM_IMPORTED ON)

after my next try, everything got fine and I didn't face any error.

I opened cmake.bbclass file and I saw these lines in a cmake_do_configure() function:

cmake \
      ${OECMAKE_GENERATOR_ARGS} \
      $oecmake_sitefile \
      ${OECMAKE_SOURCEPATH} \
      -DCMAKE_INSTALL_PREFIX:PATH=${prefix} \
      -DCMAKE_INSTALL_BINDIR:PATH=${@os.path.relpath(d.getVar('bindir'), d.getVar('prefix') + '/')} \
      -DCMAKE_INSTALL_SBINDIR:PATH=${@os.path.relpath(d.getVar('sbindir'), d.getVar('prefix') + '/')} \
      -DCMAKE_INSTALL_LIBEXECDIR:PATH=${@os.path.relpath(d.getVar('libexecdir'), d.getVar('prefix') + '/')} \
      -DCMAKE_INSTALL_SYSCONFDIR:PATH=${sysconfdir} \
      -DCMAKE_INSTALL_SHAREDSTATEDIR:PATH=${@os.path.relpath(d.getVar('sharedstatedir'), d.  getVar('prefix') + '/')} \
      -DCMAKE_INSTALL_LOCALSTATEDIR:PATH=${localstatedir} \
      -DCMAKE_INSTALL_LIBDIR:PATH=${@os.path.relpath(d.getVar('libdir'), d.getVar('prefix') + '/')} \
      -DCMAKE_INSTALL_INCLUDEDIR:PATH=${@os.path.relpath(d.getVar('includedir'), d.getVar('prefix') + '/')} \
      -DCMAKE_INSTALL_DATAROOTDIR:PATH=${@os.path.relpath(d.getVar('datadir'), d.getVar('prefix') + '/')} \
      -DCMAKE_INSTALL_SO_NO_EXE=0 \
      -DCMAKE_TOOLCHAIN_FILE=${WORKDIR}/toolchain.cmake \
      -DCMAKE_NO_SYSTEM_FROM_IMPORTED=1 \
      ${EXTRA_OECMAKE} \
      -Wno-dev

by default CMAKE_NO_SYSTEM_FROM_IMPORTED is set to 1. therefor, logically I don't need to set this variable in my recipe or cmake.

why EXTRA_OECMAKE and CMake cmake_do_configure() didn't work correctly?

I checked my cmake, and I am sure that I didn't change any CXX flags in it.

来源:https://stackoverflow.com/questions/59478990/using-extra-oecmake-doesnt-have-any-effect-in-cmake-variable-in-bitbake-recipe

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!