gpt4 book ai didi

Linux 上的 CMake : "target platform does not support dynamic linking"

转载 作者:行者123 更新时间:2023-12-04 00:03:36 25 4
gpt4 key购买 nike

我有很简单的CMakeLists.txt

CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
FIND_PACKAGE(VTK REQUIRED)
PROJECT(test CXX)

那真的什么都做不了。在 /usr/lib/vtk-5.8/VTKConfig.cmake 下正确找到了 VTK 包.该文件包含许多类型的语句
ADD_LIBRARY(foobar SHARED IMPORTED)

表示共享库 libfoobar.so需要在可执行文件中链接。

但是,在使用上述脚本创建 Makefile 时,CMake 会提示
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 (INCLUDE)
/usr/share/cmake-2.8/Modules/FindVTK.cmake:73 (FIND_PACKAGE)
CMakeLists.txt:4 (FIND_PACKAGE)
This warning is for project developers. Use -Wno-dev to suppress it

这个警告是什么意思,如何处理?

这是一个带有 CMake 2.8.9 的 Linux 系统。虽然对于包含 ADD_LIBRARY(foobar SHARED IMPORTED) 的所有软件包都会出现此错误消息,这里以VTK-5.8为例。

最佳答案

PROJECT 设置有关平台的一些重要变量。
在将名称设置为 PROJECT 之前不要调用 FIND* 模块。

关于Linux 上的 CMake : "target platform does not support dynamic linking",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12264299/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com