louis-langholtz / PlayRho

An interactive physics engine & library.
zlib License
133 stars 24 forks source link

CMake: export of targets not used at all in config file #427

Closed SpaceIm closed 1 year ago

SpaceIm commented 2 years ago

The file created during export of targets should be included in config file, otherwise it's completely useless.

Currently, a downstream project can't link imported target PlayRho (or PlayRho_shared) after a find_package(PlayRho). It ends up linking the raw library through CMake, not the target abstraction, so it's fragile.

Looking at git history, this CMakeLists was cherry picked from an old version of Box2D (when it was more or less broken).

I would advice to:

With these suggestions, users will be able to easily consume PlayRho in their project with:

find_package(PlayRho REQUIRED)
target_link_libraries(mytarget PRIVATE PlayRho::PlayRho)
louis-langholtz commented 2 years ago

Hi Spacelm,

Sounds like useful suggestions. Thank you for these!

Do you by chance already have these change suggestions in a branch that you'd like to make a pull request (PR) from? Just asking though. I can make the changes of course but I'm happy to give you credit for them in the form of taking a PR from you.

louis-langholtz commented 1 year ago

I've merged commit ce2b95fae5f394792fa1703e2383fd89a8690725 into the master branch and cherry picked that as commit 4933b021dee8ea12eb72cebb5287b9ea1dd462ba into the release-1.1.1 branch I'm targeting for eventually tagging and releasing as release 1.1.1.