I am using cmake project and trying to link libtorch in my library but seems to have issues in linking with “cmake --target install”.
In CmakeLists.txt I have
target_link_libraries(${MY_LIBRARY_NAME} PRIVATE "${TORCH_LIBRARIES}")
Torch libraries are : torch;torch_library; $LIBTORCH_PATH/lib/libc10.so;$LIBTORCH_PATH//lib/libkineto.a
Added libtorch include directories
target_include_directories(${MY_LIBRARY_NAME}
PUBLIC
"$<BUILD_INTERFACE:${TORCH_INCLUDE_DIRS}>")
But when I use My library in example test I get undefined reference symbol from linc10.so
undefined reference to symbol
'_ZN3c106detail23torchInternalAssertFailEPKcS2_jS2_RKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE'
lib/libc10.so: error adding symbols: DSO missing from command line
Any help is well appreciated.
Thanks