TipsAndTricks/Cmake,Eclipse, and SDKS: Difference between revisions

From Yocto Project
Jump to navigationJump to search
(Created page with "= Cmake,Eclipse, and SDKS: Oh My!= Suppose you would like to use cmake in an sdk &/or would like to use cmake from the Yocto Eclipse plugin. There's a couple of tricks/issue...")
 
No edit summary
Line 17: Line 17:
This can get confusing because it may be unclear which cmake eclipse is using, if you have one in the sdk and one installed on the host.  To make sure you get the cmake from the sdk, launch eclipse from a terminal that has already sourced the environment script. For example, :
This can get confusing because it may be unclear which cmake eclipse is using, if you have one in the sdk and one installed on the host.  To make sure you get the cmake from the sdk, launch eclipse from a terminal that has already sourced the environment script. For example, :
  <code>
  <code>
  $ . /home/me/poky-qemuarm-2.2-cmake/environment-setup-armv5e-poky-linux-gnueab
  $ . /home/me/poky-qemuarm-2.2-cmake/environment-setup-armv5e-poky-linux-gnueabi
  $ /home/me/eclipse/eclipse
  $ /home/me/eclipse/eclipse
  </code>
  </code>
Line 24: Line 24:
<br>
<br>
<strong> Note: the current sdk's published on downloads.yoctoproject.org as of release 2.3 do NOT include cmake </strong>
<strong> Note: the current sdk's published on downloads.yoctoproject.org as of release 2.3 do NOT include cmake </strong>
== Using the Eclipse plugin with the cmake from the build directory ==
This is a bit harder, since we won't have the sdk environment setup script to help us.  To get cmake to work in this case, you need to point the Yocto Eclipse plugin at your build environment as described in [[RunningEclipseAgainstBuiltImage]] and then go to <code>Project->Properties->C/C++ Build/Setting/CMake configure </code> and change the <code> Command: cmake </code> to <code> Command: <path to builddir>/tmp/sysroots/x86_64/linux/usr/bin/cmake </code>.  This will let Eclipse find the cmake in your build sysroot and use it.

Revision as of 18:14, 10 February 2017

Cmake,Eclipse, and SDKS: Oh My!

Suppose you would like to use cmake in an sdk &/or would like to use cmake from the Yocto Eclipse plugin. There's a couple of tricks/issues to be aware of.

Getting cmake into your sdk

Normally, if you do

$ bitbake core-image-sato -c populate_sdk  

the generated sdk does not include the build system created cmake. Using the host cmake, cross compilation will often work, but you will not have all the cmake options set to the generated cmake.
If you would like to include the generated cmake in your sdk , you need to add the following to your local.conf fille:


TOOLCHAIN_HOST_TASK_append = "${SDK_EXTRA_TOOLS}" 
SDK_EXTRA_TOOLS = " nativesdk-cmake     " 

Using the Eclipse plugin with the cmake from the sdk

This can get confusing because it may be unclear which cmake eclipse is using, if you have one in the sdk and one installed on the host. To make sure you get the cmake from the sdk, launch eclipse from a terminal that has already sourced the environment script. For example, :


$ . /home/me/poky-qemuarm-2.2-cmake/environment-setup-armv5e-poky-linux-gnueabi
$ /home/me/eclipse/eclipse

That way, eclipse will find the "correct" cmake and wont complain about either CMAKE_ROOT or "cmake not installed properly"


Note: the current sdk's published on downloads.yoctoproject.org as of release 2.3 do NOT include cmake

Using the Eclipse plugin with the cmake from the build directory

This is a bit harder, since we won't have the sdk environment setup script to help us. To get cmake to work in this case, you need to point the Yocto Eclipse plugin at your build environment as described in RunningEclipseAgainstBuiltImage and then go to Project->Properties->C/C++ Build/Setting/CMake configure and change the Command: cmake to Command: <path to builddir>/tmp/sysroots/x86_64/linux/usr/bin/cmake . This will let Eclipse find the cmake in your build sysroot and use it.