Hi Steve,

On Wed, 15 Sep 2021 21:32:28 -0500 Steven Robbins <st...@sumost.ca> wrote:
I just packaged new googletest 1.11.0. I did look for a meson wrap but was not successful. The wrap files for 1.10 are pretty simple and I thought about just blindly using them -- but I don't want to be guessing. Do you have a suggestion on how to test this meson-wrapped gtest?
The simplest way is to set up a meson subproject "gtest" by
symlinking to /usr/src/googletest. I attached a toy project as an
example.

Unfortunately, the symlink has to be created manually as a hack, because

a) the meson developers have a rather strict policy to not include
arbitrary external folders as "subdirectories", such as it could be
done with CMake via

    add_subdirectory(/usr/src/googletest googletest-build)


b) there is no way yet[1] for Debian to intercept wrap downloads
and substitute them with locally installed versions.

Personally, I don't see much reason to force a compile from source
for GTest anyway (besides the usual one, Google being Google wants
to do it their way), so I'd simply go with

    gtest_main_dep = dependency(
        'gtest_main',
        fallback: ['gtest', 'gtest_main_dep']
    )

This will find GTest using pkg-config and use the wrapper as
fallback if it is not available.

Cheers
Timo


[1] The maven package in Debian has a cool implementation for this,
maybe the concept can be adopted for meson.

--
⢀⣴⠾⠻⢶⣦⠀   ╭────────────────────────────────────────────────────╮
⣾⠁⢠⠒⠀⣿⡁   │ Timo Röhling                                       │
⢿⡄⠘⠷⠚⠋⠀   │ 9B03 EBB9 8300 DF97 C2B1  23BF CC8C 6BDD 1403 F4CA │
⠈⠳⣄⠀⠀⠀⠀   ╰────────────────────────────────────────────────────╯

Attachment: meson-gtest-example.tar.gz
Description: application/gzip

Attachment: signature.asc
Description: PGP signature

Reply via email to