[Pkg-cmake-team] Bug#1061533: cmake: CMake doesn't find googletest
Jonathan Neuschäfer
j.neuschaefer at gmx.net
Fri Jan 26 00:20:03 GMT 2024
Package: cmake
Version: 3.28.1-1
Severity: normal
X-Debbugs-Cc: smr at debian.org, hallon at debian.org
Hello, I have installed cmake 3.28.1-1 and googletest 1.14.0-1 from
Debian testing, and I'm trying to use GTest with CMake as follows:
```
# CMakeLists.txt
cmake_minimum_required(VERSION 3.14)
project(foo)
enable_testing()
find_package(GTest REQUIRED)
add_executable(foo foo.cc)
target_link_libraries(foo GTest::gtest GTest::gtest_main)
add_test(AllTestsInFoo foo)
```
```
// foo.cc
TEST(Foo, foo) {
EXPECT_EQ(1 + 2, 3);
}
```
This is very close to the example provided in /usr/share/cmake-3.28/Modules/FindGTest.cmake,
but it fails:
```
$ cmake .
-- The C compiler identification is GNU 13.2.0
-- The CXX compiler identification is GNU 13.2.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/lib/ccache/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/lib/ccache/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
CMake Error at /usr/share/cmake-3.28/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
Could NOT find GTest (missing: GTEST_LIBRARY GTEST_INCLUDE_DIR
GTEST_MAIN_LIBRARY)
Call Stack (most recent call first):
/usr/share/cmake-3.28/Modules/FindPackageHandleStandardArgs.cmake:600 (_FPHSA_FAILURE_MESSAGE)
/usr/share/cmake-3.28/Modules/FindGTest.cmake:270 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
CMakeLists.txt:5 (find_package)
-- Configuring incomplete, errors occurred!
```
This usecase doesn't seem to unusual, so I suspect a bug somewhere in
FindGTest.cmake or maybe a missing file somewhere.
Best regards.
-- System Information:
Debian Release: trixie/sid
APT prefers testing
APT policy: (500, 'testing')
Architecture: amd64 (x86_64)
Foreign Architectures: i386
Kernel: Linux 6.5.0-5-amd64 (SMP w/12 CPU threads; PREEMPT)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), LANGUAGE=en_US:en
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled
Versions of packages cmake depends on:
ii cmake-data 3.28.1-1
ii libarchive13 3.7.2-1
ii libc6 2.37-13
ii libcurl4 8.5.0-2
ii libexpat1 2.5.0-2+b2
ii libgcc-s1 13.2.0-10
ii libjsoncpp25 1.9.5-6+b2
ii librhash0 1.4.3-3
ii libstdc++6 13.2.0-10
ii libuv1 1.46.0-3
ii procps 2:4.0.4-2+b1
ii zlib1g 1:1.3.dfsg-3+b1
Versions of packages cmake recommends:
ii gcc 4:13.2.0-2
ii make 4.3-4.1
Versions of packages cmake suggests:
pn cmake-doc <none>
pn cmake-format <none>
pn elpa-cmake-mode <none>
ii ninja-build 1.11.1-2
-- no debconf information
More information about the Pkg-cmake-team
mailing list