Mir

Merge lp:~alan-griffiths/mir/fix-gtest-dependencies into lp:mir

Proposed by Alan Griffiths on 2017-10-24
Status: Merged
Approved by: Alan Griffiths on 2017-10-25
Approved revision: 4301
Merged at revision: 4301
Proposed branch: lp:~alan-griffiths/mir/fix-gtest-dependencies
Merge into: lp:mir
Prerequisite: lp:~alan-griffiths/mir/no-cmake-extras
Diff against target: 54 lines (+14/-15)
1 file modified
cmake/FindGtestGmock.cmake (+14/-15)
To merge this branch: bzr merge lp:~alan-griffiths/mir/fix-gtest-dependencies
Reviewer Review Type Date Requested Status
Brandon Schaefer (community) 2017-10-24 Approve on 2017-10-24
Mir CI Bot continuous-integration Approve on 2017-10-24
Review via email: mp+332723@code.launchpad.net

Commit message

The recent reworking of cmake/FindGtestGmock.cmake left us with a race between gtest building and being used. This fixes that.

To post a comment you must log in.
Mir CI Bot (mir-ci-bot) wrote :

PASSED: Continuous integration, rev:4301
https://mir-jenkins.ubuntu.com/job/mir-ci/3756/
Executed test runs:
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-mir/5165
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-0-fetch/5402
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=artful/5389
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=xenial/5389
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=zesty/5389
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=artful/5208
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=artful/5208/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=zesty/5208
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=zesty/5208/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=artful/5208
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=artful/5208/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial/5208
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial/5208/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=zesty/5208
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=zesty/5208/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=mesa,release=artful/5208
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=mesa,release=artful/5208/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=mesa,release=zesty/5208
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=mesa,release=zesty/5208/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial/5208
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial/5208/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://mir-jenkins.ubuntu.com/job/mir-ci/3756/rebuild

review: Approve (continuous-integration)
Brandon Schaefer (brandontschaefer) wrote :

lgtm

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'cmake/FindGtestGmock.cmake'
2--- cmake/FindGtestGmock.cmake 2017-10-23 09:51:40 +0000
3+++ cmake/FindGtestGmock.cmake 2017-10-24 15:56:51 +0000
4@@ -10,25 +10,28 @@
5 PATHS /usr/src/gtest /usr/src/googletest/googletest/
6 DOC "Path to GTest CMake project")
7
8- ExternalProject_Add(gtest PREFIX ./gtest
9+ ExternalProject_Add(GTest PREFIX ./gtest
10 SOURCE_DIR ${GTEST_ROOT}
11 CMAKE_ARGS
12+ -DCMAKE_CXX_COMPILER_WORKS=1
13 -DCMAKE_CXX_FLAGS='${CMAKE_CXX_FLAGS}'
14- -DCMAKE_CXX_COMPILER_WORKS=1
15- -DCMAKE_C_COMPILER_WORKS=1
16- -DCMAKE_FIND_ROOT_PATH=${CMAKE_FIND_ROOT_PATH}
17 -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}
18- -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
19- -DCMAKE_FIND_ROOT_PATH=${CMAKE_FIND_ROOT_PATH}
20 INSTALL_COMMAND true)
21
22- set(GTEST_LIBRARY "-lgtest")
23- set(GTEST_MAIN_LIBRARY "-lgtest_main")
24+ ExternalProject_Get_Property(GTest binary_dir)
25+
26+ add_library(gtest UNKNOWN IMPORTED)
27+ set_target_properties(gtest PROPERTIES IMPORTED_LOCATION ${binary_dir}/libgtest.a)
28+ add_dependencies(gtest GTest)
29+ set(GTEST_LIBRARY "gtest")
30+
31+ add_library(gtest_main UNKNOWN IMPORTED)
32+ set_target_properties(gtest_main PROPERTIES IMPORTED_LOCATION ${binary_dir}/libgtest_main.a)
33+ add_dependencies(gtest_main GTest)
34+ set(GTEST_MAIN_LIBRARY "gtest_main")
35+
36 set(GTEST_BOTH_LIBRARIES ${GTEST_LIBRARY} ${GTEST_MAIN_LIBRARY})
37- set(GTEST_DEPENDENCIES "gtest")
38- set(GTEST_FOUND TRUE)
39 find_path(GTEST_INCLUDE_DIRS NAMES gtest/gtest.h)
40- link_directories(${CMAKE_CURRENT_BINARY_DIR}/gtest/src/gtest-build)
41 find_package_handle_standard_args(GTest GTEST_LIBRARY GTEST_BOTH_LIBRARIES GTEST_INCLUDE_DIRS)
42 endif()
43
44@@ -51,10 +54,6 @@
45 set_source_files_properties(${GMOCK_SOURCE} PROPERTIES COMPILE_FLAGS "-I/usr/src/gmock")
46 endif()
47
48-if (TARGET gtest)
49- add_dependencies(GMock gtest)
50-endif()
51-
52 find_package_handle_standard_args(GMock DEFAULT_MSG GMOCK_INCLUDE_DIR)
53
54 set(GMOCK_LIBRARY GMock)

Subscribers

People subscribed via source and target branches