ParaView插件CMakeLists.txt中的链接库 [英] Link library in ParaView plugin CMakeLists.txt

查看:115
本文介绍了ParaView插件CMakeLists.txt中的链接库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

最近,我一直在尝试为ParaView编写插件,而在尝试链接外部库时遇到了问题.首先,我必须说编译可以正常进行,但是在运行时出现一个错误,说出了可怕的词:符号查找错误..未定义符号".

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".

在加载到ParaView的文件上使用ldd时,未列出此插件所需的vxl库文件.ParaView有它自己在CmakeLists.txt文件中定义插件的怪异方式,这就是为什么我很难找到有关如何正确链接此库的信息的原因.

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.

我的CMakeLists.txt现在看起来如下:

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 
)

推荐答案

这不是很明显,但是您应该可以将库添加到 Main 目标中,而 add_paraview_plugin 定义

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)

或任何库名.

这篇关于ParaView插件CMakeLists.txt中的链接库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆