Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@gobater
Copy link
Contributor

@gobater gobater commented Mar 16, 2024

No description provided.

@gobater
Copy link
Contributor Author

gobater commented Mar 16, 2024

@KarlStraussberger , could you help understanding why the CI is failing? gmock_main is a target available with vanilla googletest.

@KarlStraussberger
Copy link
Member

I think it's got to be GMock::gmock_main. It's in FindGMock.cmake

@gobater
Copy link
Contributor Author

gobater commented Mar 17, 2024

I think it's got to be GMock::gmock_main. It's in FindGMock.cmake

Weird... in the "official" GTestTargets.cmake (supplied with googletest) and available by default in my development Docker container (which is based on https://github.com/gerbera/gerbera/blob/master/Dockerfile) its "GTest::gmock_main" (not to add it works on my machine :-) ).

The problem probably is in tests\CMakelists.txt:

find_package(GTest REQUIRED)

# CMake can't fix gmock support. https://gitlab.kitware.com/cmake/cmake/-/issues/17365
# So for non-conan build we need to find it separately.
if (NOT "${GTest_LIBRARY_LIST}" MATCHES "gmock")
    find_package(GMock REQUIRED)
    set_property(TARGET GTest::GTest APPEND PROPERTY INTERFACE_LINK_LIBRARIES ${GMOCK_LIBRARIES})
endif()

If I replace GTest::gmock_main with GMock::gmock_main it does not work in my container (probably will work in the CI). The question is, what's different in the CI build? It seems to use an different version of cmake or googletest...

@gobater
Copy link
Contributor Author

gobater commented Mar 17, 2024

So... it's a cmake version issue... see:
https://cmake.org/cmake/help/latest/module/FindGTest.html

@gobater gobater force-pushed the gmock_main branch 2 times, most recently from 046da14 to 806f7fa Compare March 17, 2024 09:08
@gobater
Copy link
Contributor Author

gobater commented Mar 17, 2024

OK, there seems to be something with the conan build. I can also see some warnings about using deprecated functions in the log...

@KarlStraussberger
Copy link
Member

I already started migrating to conan2, but it's not as straighforward as it should be.

@gobater
Copy link
Contributor Author

gobater commented Mar 17, 2024

No worries. We can leave this PR open until then...

@KarlStraussberger
Copy link
Member

Now you can try your changes. Conan2 was really a stubborn mule.

@gobater gobater force-pushed the gmock_main branch 2 times, most recently from 22a5e9b to f614edf Compare March 29, 2024 20:09
@gobater
Copy link
Contributor Author

gobater commented Mar 29, 2024

@KarlStraussberger , I'm not an expert in conan. It seems that the installed gtest/gmock package is built in Release, while in the CI Job we are building in Debug so it cannot link to libgmockd... not sure how to solve and why it's working without the GTest::gmock_main target

@KarlStraussberger
Copy link
Member

We have */shared=True in conan/dev. Maybe you can go with gtest/*:shared=False or even force gtest/*:build_type=Debug.

@gobater
Copy link
Contributor Author

gobater commented Oct 26, 2025

I hope I find some time soon to work again on this :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants