cmake中添加引用动态链接_Linux上的CMake:“目标平台不支持动态链接”

当使用CMake在Linux系统上构建项目时,遇到警告提示目标平台不支持动态链接。该问题源于CMake全局属性TARGET_SUPPORTS_SHARED_LIBS被设置为false,而尝试使用共享库。解决方案可能涉及CMake版本的bug或配置错误。检查CMake源代码中的cmAddLibraryCommand.cxx第100行以了解更多。
摘要由CSDN通过智能技术生成

I have the very simple CMakeLists.txt

CMAKE_MINIMUM_REQUIRED(VERSION 2.8)

FIND_PACKAGE(VTK REQUIRED)

PROJECT(test CXX)

that really doesn't do anything. The package VTK is correctly found under /usr/lib/vtk-5.8/VTKConfig.cmake. This file includes a number of statements of the type

ADD_LIBRARY(foobar SHARED IMPORTED)

to indicate that the shared library libfoobar.so will need to be linked in executables.

Upon creating Makefiles using the above script, however, CMake will complain that

CMake Warning (dev) at /usr/lib/vtk-5.8/VTKTargets.cmake:244 (ADD_LIBRARY):

ADD_LIBRARY called with SHARED option but the target platform does not

support dynamic linking. Building a STATIC library instead. This may lead

to problems.

Call Stack (most recent call first):

/usr/lib/vtk-5.8/VTKConfig.cmake:200 (IN

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值