问题
Recently I've been trying to write a plugin for ParaView and I have encountered a problem while trying to link external libraries. First of all I must say that the compilation goes fine but I get an error at runtime saying the dreaded words: "symbol lookup error .. undefined symbol".
When using ldd on the file that I load into ParaView, none of the vxl library files that are required for this plugin are listed. ParaView has it's own weird way of defining plugins in the CmakeLists.txt file and this is why it's so hard for me to find information on how to link this library properly.
My CMakeLists.txt looks as follows now:
cmake_minimum_required(VERSION 2.8)
IF (ParaView_SOURCE_DIR)
INCLUDE_DIRECTORIES(
${VTK_INCLUDE_DIRS}
)
ELSE (ParaView_SOURCE_DIR)
FIND_PACKAGE(ParaView REQUIRED)
INCLUDE(${PARAVIEW_USE_FILE})
ENDIF (ParaView_SOURCE_DIR)
FIND_PACKAGE(VXL)
IF(VXL_FOUND)
INCLUDE(${VXL_CMAKE_DIR}/UseVXL.cmake)
ENDIF(VXL_FOUND)
INCLUDE_DIRECTORIES(${VXLCORE_INCLUDE_DIR})
ADD_PARAVIEW_PLUGIN(Main "0.0"
SERVER_MANAGER_XML Main.xml
SERVER_MANAGER_SOURCES Main.cxx LSModelFit.cxx
)
回答1:
It isn't obvious, but you should be able to just add a library to the Main
target that add_paraview_plugin
defines with
target_link_libraries(Main vxl)
or whatever the library name is.
来源:https://stackoverflow.com/questions/35971739/link-library-in-paraview-plugin-cmakelists-txt