[Bug 1986665] Re: [SRU] CMake imported targets GTest::gmock and GTest::gmock_main are not available

Launchpad Bug Tracker 1986665 at bugs.launchpad.net
Mon Sep 12 14:16:13 UTC 2022


This bug was fixed in the package cmake - 3.22.1-1ubuntu1.22.04.1

---------------
cmake (3.22.1-1ubuntu1.22.04.1) jammy; urgency=medium

  * Cherry pick upstream change to fix FindGTest for Gmock (LP:
#1986665)

 -- Gianfranco Costamagna <locutusofborg at debian.org>  Wed, 17 Aug 2022
12:44:06 +0200

** Changed in: cmake (Ubuntu Jammy)
       Status: Fix Committed => Fix Released

-- 
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to cmake in Ubuntu.
https://bugs.launchpad.net/bugs/1986665

Title:
  [SRU] CMake imported targets GTest::gmock and GTest::gmock_main are
  not available

Status in cmake:
  Fix Released
Status in cmake package in Ubuntu:
  Fix Released
Status in cmake source package in Jammy:
  Fix Released
Status in cmake source package in Kinetic:
  Fix Released

Bug description:
  [ Test plan ]
  cat CMakeLists.txt

  project(foo)
  cmake_minimum_required(VERSION 3.22)
  find_package(GTest)

  
  with the patch, a cmake .. and libgmock-dev installed results in this:
  grep mock . -Ri
  ./CMakeFiles/Makefile.cmake:  "/usr/lib/x86_64-linux-gnu/cmake/GTest/GMockTargets-none.cmake"
  ./CMakeFiles/Makefile.cmake:  "/usr/lib/x86_64-linux-gnu/cmake/GTest/GMockTargets.cmake"

  [ Where problems could occur ]
  * Nowhere, its an upstream patch that don't regress the current status quo, just adding some new variables.

  [ Other Info ]
  The libgtest-dev and libgmock-dev are both built from the googletest source package. Googletest upstream has provided a CMake **config file package** since version 1.8.1, but for many releases, this config file package has not been included in the -dev packages.

  When developers build a CMake project that wants to use a prebuilt
  GoogleTest for testing, they typically call FindPackage(GTest
  <REQUIRED_VERSION>) to locate the library. Since the config file
  package has not been included in libgtest-dev, the FindPackage CMake
  call falls back to using the FindGTest.cmake module originating from
  cmake and included in the cmake-data package.

  So for several releases up to and including jammy jellyfish, the Imported targets:
  * GTest::gtest
  * GTest::gtest_main
  * GTest::gmock
  * GTest::gmock_main

  have not been available in the distribution provided packages although
  defined by Googletest upstream.

  Issue in CMake issue tracker https://gitlab.kitware.com/cmake/cmake/-/issues/17365
  CMake Merge Request https://gitlab.kitware.com/cmake/cmake/-/merge_requests/6632
  Issue in Debian CMake packaging https://salsa.debian.org/cmake-team/cmake/-/merge_requests/11

  This issue should already be fixed in kinetic, since the CMake version
  is 3.24, which includes the update to cmake's FindGTest.cmake module.

  I would also like to get this to jammy as a low priority update.
  Applying only the patch to FindGTest.cmake should make the risk of the
  update negligible.

To manage notifications about this bug go to:
https://bugs.launchpad.net/cmake/+bug/1986665/+subscriptions




More information about the foundations-bugs mailing list