<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugzilla.yoctoproject.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.6"
          urlbase="https://bugzilla.yoctoproject.org/"
          
          maintainer="it-coreprojects-helpdesk@linuxfoundation.org"
>

    <bug>
          <bug_id>15873</bug_id>
          
          <creation_ts>2025-05-22 06:20:55 +0000</creation_ts>
          <short_desc>meson having hard time finding cmake dependencies</short_desc>
          <delta_ts>2026-04-15 19:18:19 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>7</classification_id>
          <classification>Build System, Metadata &amp; Runtime</classification>
          <product>OE-Core</product>
          <component>devtools / tool chain</component>
          <version>5.0.8</version>
          <rep_platform>x86</rep_platform>
          <op_sys>Multiple</op_sys>
          <bug_status>NEW</bug_status>
          <resolution></resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>Medium</priority>
          <bug_severity>enhancement</bug_severity>
          <target_milestone>6.1</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Toni Lammi">toni.lammi</reporter>
          <assigned_to name="Toni Lammi">toni.lammi</assigned_to>
          <cc>meta.mr.watcher</cc>
    
    <cc>meta.watcher</cc>
    
    <cc>randy.macleod</cc>
    
    <cc>ross.burton</cc>
          
          
          <cf_os>---</cf_os>
          <cf_regression_type>---</cf_regression_type>
          
          <cf_docchange>Don&apos;t know</cf_docchange>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>102023</commentid>
    <comment_count>0</comment_count>
    <who name="Toni Lammi">toni.lammi</who>
    <bug_when>2025-05-22 06:20:55 +0000</bug_when>
    <thetext>Recipes inheriting meson.bbclass don&apos;t, by default, find dependencies using cmake.

I created a simple repo to reproduce this issue: https://gitlab.com/toni.lammi.kone/meta-foo/-/tree/master/recipes-foo/app?ref_type=heads

I&apos;ve fixed this with a custom meson-cmake.bbclass with pretty trivial contents:
```
inherit cmake meson

# This might be a meson bug, cmake executable is not found otherwise
export CMAKE=&quot;cmake&quot;

do_write_config:append(){
    # Point meson to correct cmake toolchain file to find dependencies correctly
    sed -i &apos;/^\[properties\]/acmake_toolchain_file=&apos;&quot;&apos;${WORKDIR}/toolchain.cmake&apos;&quot; \
        ${WORKDIR}/meson.cross
}
```

I&apos;m wondering if this should be handled in meson.bbclass directly? For instance MESON_USE_CMAKE variable which would enable this cmake functionality.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>102037</commentid>
    <comment_count>1</comment_count>
    <who name="Ross Burton">ross.burton</who>
    <bug_when>2025-05-22 14:47:37 +0000</bug_when>
    <thetext>Inheriting both cmake and meson in the same recipe seems a little heavy-handed. I wonder how minimal a cmake toolchain file needs to be, considering it&apos;s only used for finding the module scripts?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>102059</commentid>
    <comment_count>2</comment_count>
    <who name="Toni Lammi">toni.lammi</who>
    <bug_when>2025-05-23 05:39:47 +0000</bug_when>
    <thetext>Looked into this a bit more.

All the cmake dependencies I&apos;ve been having bad time with have a dependency to openssl which depends on threads. The build config fails when cmake&apos;s threads module tries to check if the compiler compiler supports -pthread flag.

The build can be fixed by simply adding
```
set( CMAKE_CXX_COMPILER some-prefix-g++)
```
to the toolchain file. A similar setting is probably needed for C if the project uses that.

Meson sets the same variable in its internal cmake toolchain but the value is an absolute path to the compiler.

No idea who is at fault here: meson, cmake or FindOpenSSL.cmake.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>102062</commentid>
    <comment_count>3</comment_count>
    <who name="Ross Burton">ross.burton</who>
    <bug_when>2025-05-23 12:36:35 +0000</bug_when>
    <thetext>You&apos;d think an absolute path would be fine...</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>105084</commentid>
    <comment_count>4</comment_count>
    <who name="Randy MacLeod">randy.macleod</who>
    <bug_when>2026-04-15 19:18:19 +0000</bug_when>
    <thetext>This enhancement is apparently not implemented so bump to 6.1.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>