cmake fails with current libgtest-dev 1.6.0-1ubuntu4

Bug #969891 reported by Alexander Bürger on 2012-03-31
66
This bug affects 14 people
Affects Status Importance Assigned to Milestone
cmake (Ubuntu)
Undecided
Unassigned

Bug Description

As libgtest 1.6.0-1ubuntu4 no longer has static libraries included, cmake with

find_package(GTest REQUIRED)

fails with the present cmake(-data) 2.8.7-0ubuntu 4.

To work around this problem I commented out line 150 in /usr/share/cmake-2.8/Modules/FindGTest.cmake and used

set(GTEST_DIR /usr/src/gtest)
add_subdirectory(${GTEST_DIR} ${CMAKE_CURRENT_BINARY_DIR}/gtest EXCLUDE_FROM_ALL)
link_directories(${CMAKE_CURRENT_BINARY_DIR}/gtest)

I am not a cmake expert, so even though this works, it probably it is not a good solution.

ProblemType: Bug
DistroRelease: Ubuntu 12.04
Package: cmake-data 2.8.7-0ubuntu4 [modified: usr/share/cmake-2.8/Modules/FindGTest.cmake]
ProcVersionSignature: Ubuntu 3.2.0-20.33-generic 3.2.12
Uname: Linux 3.2.0-20-generic x86_64
ApportVersion: 2.0-0ubuntu2
Architecture: amd64
Date: Sat Mar 31 11:13:51 2012
InstallationMedia: Ubuntu 12.04 LTS "Precise Pangolin" - Beta amd64 (20120328)
PackageArchitecture: all
ProcEnviron:
 LANGUAGE=en_US:en
 TERM=xterm
 PATH=(custom, user)
 LANG=en_US.UTF-8
 SHELL=/bin/bash
SourcePackage: cmake
UpgradeStatus: No upgrade log present (probably fresh install)

Alexander Bürger (acfb) wrote :
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in cmake (Ubuntu):
status: New → Confirmed
H3g3m0n (h3g3m0n) wrote :

Seems the package doesn't ship with the binary parts compiled.

There is a better work around here that avoids editing files:
http://www.thebigblob.com/getting-started-with-google-test-on-ubuntu/

sudo apt-get install cmake # install cmake
cd /usr/src/gtest
sudo cmake CMakeLists.txt
sudo make
sudo cp *.a /usr/lib

This may be intentional due to the possibility of gtest using a different compiler to your project:
https://groups.google.com/forum/?fromgroups#!topic/googletestframework/Zo7_HOv1MJ0

Would be nice to see a better work around though (Maybe a CMake module that builds the framework using your projects compiler and uses that?)

probably this should be reported and fixed upstream

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers