introlab / rtabmap

RTAB-Map library and standalone application
https://introlab.github.io/rtabmap
Other
2.83k stars 787 forks source link

JsonCpp::JsonCpp target already existing error when including OusterSDK (Ubuntu 22.04) #1318

Closed matlabbe closed 3 months ago

matlabbe commented 3 months ago
-- Found OusterSDK: /usr/local/lib/cmake/OusterSDK/OusterSDKConfig.cmake
CMake Error at /usr/lib/x86_64-linux-gnu/cmake/jsoncpp/jsoncpp-namespaced-targets.cmake:5 (add_library):
  add_library cannot create imported target "JsonCpp::JsonCpp" because
  another target with the same name already exists.
Call Stack (most recent call first):
  /usr/lib/x86_64-linux-gnu/cmake/jsoncpp/jsoncppConfig.cmake:41 (include)
  /usr/share/cmake-3.22/Modules/CMakeFindDependencyMacro.cmake:47 (find_package)
  /usr/local/lib/cmake/OusterSDK/OusterSDKConfig.cmake:7 (find_dependency)
  CMakeLists.txt:676 (FIND_PACKAGE)
matlabbe commented 3 months ago

Workaround is to apply this patch: https://github.com/open-source-parsers/jsoncpp/pull/1435/files to system jsoncpp-namespaced-targets.cmake file.