I want to pass a variable BASEWORKDIR yocto recipe variable to CMake so that it can search for library in a particular folder using find_library() function for .so library. But it is not working. I printed it also I.e for debugging the Cmake file message(${BASEWORKDIR}) but this variable is empty. This variable is defined in Bitbake.conf file in my yocto system.

1 Answers

0
squareskittles On

You could try something like this to use the Yocto environment variables in CMake:

if(DEFINED ENV{BASEWORKDIR})
    set(YOCTO_BASEWORK_DIR $ENV{BASEWORKDIR} CACHE INTERNAL "Path retrieved from environment variable.")
endif()

This creates a new CMake variable called YOCTO_BASEWORK_DIR using the system environment variable BASEWORKDIR.