Link library in ParaView plugin CMakeLists.txt

◇◆丶佛笑我妖孽 提交于 2019-12-25 06:43:47

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!