Bug 10053 - cmake projects will not build as CMAKE_MODULE_PATH is set to wrong location
Summary: cmake projects will not build as CMAKE_MODULE_PATH is set to wrong location
Status: RESOLVED FIXED
Alias: None
Product: eSDK
Classification: Yocto Project Subprojects
Component: eSDK (show other bugs)
Version: 2.1.1
Hardware: x86 Multiple
: Medium normal
Target Milestone: 2.2
Assignee: Ross Burton
QA Contact: Francisco Pedraza
URL:
Whiteboard:
Depends on:
Blocks:
 
Reported: 2016-07-29 19:52 UTC by Henry Bruce
Modified: 2016-10-28 13:15 UTC (History)
3 users (show)

See Also:
OS type for building Yocto: ---
Type of Regression: ---
Verified:
Documentation change: No (bug/feature does not impact docs)


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Henry Bruce 2016-07-29 19:52:10 UTC
Observed behavior
-----------------
When building a cmake application within eSDK, CMAKE_MODULE_PATH is set to /path/to/esdk/tmp/sysroots/$MACHINE/usr/share/cmake/Modules, but nativesdk-cmake installs files to /path/to/esdk/tmp/sysroots/x86_64-linux/usr/share/cmake-${PN}/Modules.

As a result all cmake package detection calls will fail with errors such as
|   By not providing "FindOpenCV.cmake" in CMAKE_MODULE_PATH this project has
|   asked CMake to find a package configuration file provided by "OpenCV", but
|   CMake did not find one.


Expected behavior
-----------------
cmake project will be built as on native host.
Comment 1 Richard Purdie 2016-08-04 14:44:59 UTC
Looking at cmake.bbclass, it looks like this *is* target specific, list(APPEND CMAKE_MODULE_PATH "${STAGING_DATADIR}/cmake/Modules/")
 which means we make need to install target cmake modules files into the sdk in order to support cmake?
Comment 2 Ross Burton 2016-10-10 16:19:56 UTC
So I've spent *way* too long learning all about the horrible ways that cmake does stupid things to piss you off.

That message is *so* misleading it's not even funny.

I'll note that for some reason the cmake files for opencv are part of opencv-apps, so it's entirely possible that they're not in the SDK.  Can you verify that you have a /usr/share/OpenCV/OpenCVConfig.cmake inside your SDK's target sysroot?
Comment 3 Ross Burton 2016-10-10 16:32:11 UTC
https://patchwork.openembedded.org/patch/132795/ is my fix to opencv to put the cmake files into opencv-dev.
Comment 4 Henry Bruce 2016-10-12 23:45:21 UTC
Nice work. Ross. I have validated that the patch solves the problem. I'll leave open until patch is merged into meta-oe.

How do I request a backport for krogoth?
Comment 5 Ross Burton 2016-10-13 08:39:47 UTC
Once it's merged remind me and I'll backport it.
Comment 6 Ross Burton 2016-10-19 15:06:24 UTC
Marking as 2.2 as this isn't actually a oe-core but, but meta-oe.
Comment 7 Ross Burton 2016-10-28 13:15:48 UTC
Fix to opencv merged in meta-oe fded4cf6a8cf1ff065af97f3283b55aeba458d28.