Skip to content

Fix imstkFind.cmake

I've had issues with building against iMSTK in the Osteotomy Trainer project. I've had to make the following changes to make it work.

Without if(${PACKAGE}_FOUND AND NOT TARGET ${tgt_name}) I get the following error: the following error:

CMake Error at .../iMSTK-build/install/lib/cmake/iMSTK-2.0/modules/imstkFind.cmake:192 (add_library): add_library cannot create imported target "g3log" because another target with the same name already exists.

Without the if (${PACKAGE}_FOUND) I get the following error:

CMake Error at .../iMSTK-build/install/lib/cmake/iMSTK-2.0/modules/Findg3log.cmake:17 (target_link_libraries): Cannot specify link libraries for target "g3log" which is not built by this project.

Note that probably don't need to check if (${PACKAGE}_FOUND (...) in the last if since it's checked before. @aaron.bray What do you think ?

Merge request reports