artivis / manif

A small C++11 header-only library for Lie theory.
https://artivis.github.io/manif
MIT License
1.51k stars 246 forks source link

Fix link to GTest if GTest is found via find_package #305

Closed traversaro closed 3 months ago

traversaro commented 3 months ago

Thanks @artivis for the new tag! I was updating the release in conda-forge, and I took the occasion to re-enable the tests there on Windows.

I noticed that the 0.0.5 for us build was failing with an error related to gtest:

CMake Error at test/CMakeLists.txt:37 (add_dependencies):
  The dependency target "gtest" of target "gtest_misc" does not exist.
Call Stack (most recent call first):
  test/CMakeLists.txt:53 (manif_add_gtest)

CMake Error at test/CMakeLists.txt:37 (add_dependencies):
  The dependency target "gtest" of target "gtest_rn" does not exist.
Call Stack (most recent call first):
  test/rn/CMakeLists.txt:3 (manif_add_gtest)

So I took the occasion to cleanup the linking to gtest. I used GTest::gtest as imported target to link against, and remove the add_dependencies step as it is implicit in target_link_libraries.

artivis commented 3 months ago

@traversaro do you need a new release tho?

traversaro commented 3 months ago

@traversaro do you need a new release tho?

No, we typically do not run tests on Windows, I just did this on conda-forge and there I can use a simple patch.

artivis commented 3 months ago

Gotcha, thanks for the prompt reply.