Merge lp:~michihenning/cmake-extras/gtest-fixes into lp:cmake-extras

Proposed by Michi Henning
Status: Merged
Approved by: Michi Henning
Approved revision: 44
Merged at revision: 44
Proposed branch: lp:~michihenning/cmake-extras/gtest-fixes
Merge into: lp:cmake-extras
Diff against target: 29 lines (+11/-4)
1 file modified
src/FindGMock.cmake (+11/-4)
To merge this branch: bzr merge lp:~michihenning/cmake-extras/gtest-fixes
Reviewer Review Type Date Requested Status
James Henstridge Approve
Review via email: mp+311565@code.launchpad.net

Commit message

Fixes for gtest 1.8.0. (LP: #1644062)

Description of the change

gtest 1.8.0 has broken existing builds. This adds a work-around to get the configure step to work again.

To post a comment you must log in.
Revision history for this message
James Henstridge (jamesh) wrote :

Noticed one small bug

review: Needs Fixing
44. By Michi Henning

Fix typo.

Revision history for this message
James Henstridge (jamesh) wrote :

Looks good

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/FindGMock.cmake'
2--- src/FindGMock.cmake 2015-09-14 23:15:32 +0000
3+++ src/FindGMock.cmake 2016-11-23 03:48:04 +0000
4@@ -28,15 +28,22 @@
5 # NOTE: Due to the way this package finder is implemented, do not attempt
6 # to find the GMock package more than once.
7
8-set (GMOCK_INCLUDE_DIRS "/usr/include/gmock/include" CACHE PATH "gmock source include directory")
9-set (GMOCK_SOURCE_DIR "/usr/src/gmock" CACHE PATH "gmock source directory")
10-set (GTEST_INCLUDE_DIRS "${GMOCK_SOURCE_DIR}/gtest/include" CACHE PATH "gtest source include directory")
11+if (EXISTS "/usr/src/googletest")
12+ # As of version 1.8.0
13+ set (GMOCK_SOURCE_DIR "/usr/src/googletest/googlemock" CACHE PATH "gmock source directory")
14+ set (GMOCK_INCLUDE_DIRS "${GMOCK_SOURCE_DIR}/include" CACHE PATH "gmock source include directory")
15+ set (GTEST_INCLUDE_DIRS "/usr/src/googletest/googletest/include" CACHE PATH "gtest source include directory")
16+else()
17+ set (GMOCK_SOURCE_DIR "/usr/src/gmock" CACHE PATH "gmock source directory")
18+ set (GMOCK_INCLUDE_DIRS "/usr/include/gmock/include" CACHE PATH "gmock source include directory")
19+ set (GTEST_INCLUDE_DIRS "${GMOCK_SOURCE_DIR}/gtest/include" CACHE PATH "gtest source include directory")
20+endif()
21
22 # We add -g so we get debug info for the gtest stack frames with gdb.
23 # The warnings are suppressed so we get a noise-free build for gtest and gmock if the caller
24 # has these warnings enabled.
25 set(old_cxx_flags ${CMAKE_CXX_FLAGS})
26-set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -Wno-old-style-cast -Wno-missing-field-initializers")
27+set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -Wno-old-style-cast -Wno-missing-field-initializers -Wno-ctor-dtor-privacy -Wno-switch-default")
28 add_subdirectory(${GMOCK_SOURCE_DIR} "${CMAKE_CURRENT_BINARY_DIR}/gmock")
29 set(CMAKE_CXX_FLAGS ${old_cxx_flags})
30

Subscribers

People subscribed via source and target branches

to all changes: