examples icon indicating copy to clipboard operation
examples copied to clipboard

Add GTest example

Open uilianries opened this issue 6 years ago • 16 comments

An user from Stack Overflow is following https://github.com/lasote/conan-gtest-example. Since it's an example, I've moved it to here.

New documentation for GTest: https://github.com/conan-io/docs/pull/1668

uilianries avatar Jun 11 '19 12:06 uilianries

Do we talk about it in our docs? IMO every example here should have a reason: it is in our docs or it demonstrates some feature; otherwise CI times will grow and maintenance could be a problem

jgsogo avatar Feb 12 '20 10:02 jgsogo

we are using it indeed https://docs.conan.io/en/latest/integrations/ci/appveyor.html#building-and-testing-your-project

danimtb avatar Feb 12 '20 11:02 danimtb

I just rebased it now, let's see the result

uilianries avatar Feb 12 '20 12:02 uilianries

This example in the docs is about the appveyor.yml file (which we are not copying here, neither using it). Maybe it requires a standalone repo like this one https://github.com/conan-io/hello

jgsogo avatar Feb 13 '20 09:02 jgsogo

I don't like the idea separating all examples again. Rarely are the users which know about hello repo.

uilianries avatar Feb 13 '20 16:02 uilianries

I totally agree that we shouldn't separate the examples, but for this one we need to run the actual appveyor.yml file, otherwise we are just testing the gtest package which is something we are already doing in c3i.

And, I've just realized we have a bug in the example file, it says cmmd instead of cmd 😮

jgsogo avatar Feb 24 '20 17:02 jgsogo

mac build failed but the error is not known to me

danimtb avatar Apr 23 '20 10:04 danimtb

I tried to reproduce on MacInCloud and did happen. I'll try one more test to validate. My guess is a runtime error related to dynamic library.

uilianries avatar Apr 23 '20 16:04 uilianries

The problem is not detecting the compiler, according to this list here (https://en.wikipedia.org/wiki/Xcode#Xcode_7.0_-11.x(since_Free_On-Device_Development)) there is no apple-clang 10.13. It refers to the macOS version...

jgsogo avatar Apr 28 '20 14:04 jgsogo

Just as a reference, I've been trying the example locally and using DYLD_... && cmake --build XXXX --target test doesn't work, you need to add that variable to the environment for the given target in CMake:

set_property(TEST encryption PROPERTY ENVIRONMENT "DYLD_LIBRARY_PATH=${GTest_LIB_DIRS}")

jgsogo avatar Apr 28 '20 15:04 jgsogo

@jgsogo Thanks a lot! You and @SSE4 are helping a lot, without you supports it wouldn't be possible!

uilianries avatar Apr 29 '20 12:04 uilianries

Did you manage to fix this issue? We can try to finish this PR

jgsogo avatar May 12 '20 15:05 jgsogo

Hello,

I'm interested by a conan 2.0 example project using some tests written with GTest outside of test_package as described in "A different approach " of https://github.com/lasote/conan-gtest-example#synopsis. The ideal would be to have a simple invocation of conan as "conan create . ...". With CMakeToolchain which seems the new way to use conan with CMake. Currently I have error of https://stackoverflow.com/questions/42162014/gtest-installed-with-conan-undefined-reference and proposed answer doesn't works.

Regards.

EstebanDugueperoux2 avatar May 27 '22 09:05 EstebanDugueperoux2

@EstebanDugueperoux2 you want to refer to the examples repo for Conan 2.0: https://github.com/conan-io/examples2

memsharded avatar May 27 '22 10:05 memsharded

@EstebanDugueperoux2 you want to refer to the examples repo for Conan 2.0: https://github.com/conan-io/examples2

Yes, I'll try to submit a little example through a pull request showing my issue. Otherwise, is it normal to have a 404 Not Found when clicking on "Edit on GitHub" (top right corner) in https://docs.conan.io/en/2.0-alpha/tutorial/consuming_packages/build_simple_cmake_project.html?

Regards.

EstebanDugueperoux2 avatar May 27 '22 12:05 EstebanDugueperoux2

Yes, that link is broken for 2.0 docs, we would need to fix it

memsharded avatar May 27 '22 13:05 memsharded