cmake, scribus - 列出所有需要的库

cmake, scribus - List all required libraries

我正在尝试从 Ubuntu 20.04 中的源代码构建 Scribus(1.5.8 和 1.7)。它使用 cmake 作为构建系统。我没有使用 cmake 的经验。

有没有办法从 cmake 或任何命令行工具中获取所有必需的 and/or 可选库的列表?

现在,我的“工作流程”如下:

  1. 运行 cmake . 在源目录中。
  2. 如果失败,则转3,否则,转7。
  3. 搜索提及缺失库的错误消息。
  4. 运行 apt search 找到(希望)正确的图书馆。
  5. 运行 apt install 安装(希望)正确的库。
  6. 转到 1.
  7. 继续。

这很乏味。我希望有一些东西可以生成 cmake 将查找的库列表。理想情况下,可以简单地将此列表提供给 apt install 以拉入所有库。

尽管 scribus 开发人员在他们的 wiki 中提供了所需库的列表,但这些列表似乎并不详尽或最新。

我尝试使用 cmake --graphviz=foo.dot,但它仅在我成功从 cmake . 到 运行 后生成任何输出。

Is there a way to get a list of all the required and/or optional libraries from cmake or any command line tool?

不是以自动方式。一般来说这是不可能的。可能存在不由 CMake 管理的依赖项,在 CMake 代码之外,可能存在依赖项的依赖项,以及许多极端情况。此外,“库名称”和“项目名称”之间没有明确的映射(我的意思是,在 .so 或 .a 或 .h 文件与它来自的实际项目之间)。

通常,编译库 需要(手动)有关该库和库依赖项的知识。这正是 包维护者 在发行版中所做的工作 - 他们编译库并列出包管理器的所有库依赖项。虽然出现了更智能的“构建系统”,但这并不是灵丹妙药,而且 C++ 生态系统方式过于多样化。


但是当然 - 你 google scribus,找到来源 https://github.com/scribusproject/scribus , check the documentation, and find the dependencies of a project https://github.com/scribusproject/scribus/blob/master/BUILDING,所有列出:

Requirements:
    Qt >= 6.2
    Freetype >= 2.1.7 (2.3.x strongly recommended)
    cairo >= 1.14.x
    harfbuzz = > 0.9.42
    libicu
    libjpeg (depending on how Qt is packaged)
    libpng >= 1.6.0
    libtiff >= 3.6.0
    libxml2 >= 2.6.0
    LittleCMS (liblcms) >= 2.0 (2.1+ recommended)
    poppler and poppler-cpp >= 0.62.0
    hunspell
    Python >= 3.6

Recommended:
    CUPS
    Fontconfig >= 2.0
    GhostScript >= 8.0 (9.0+ or greater preferred)
    tkinter for the font sampler script
    python-imaging for the font sampler preview
    pkgconfig (to assist finding other libraries)
    podofo - 0.7.0+ for enhanced Illustrator AI/EPS import, svn versions
    boost and boost-devel

构建系统仍然是 巨大的 前进方向 - cmake . 库维护者可以向用户显示奇特的错误消息 "Och - install libpng, it was not found",这使得它都很愉快。它仍然比从编译器或链接器获取 -lpng: not found 消息要好得多。例如,您可以编写一个列出所有此类消息和错误的 CMake 配置,以便用户可以看到所有这些消息。