从 ParaView 构建自定义 Qt 应用程序示例时出错
Posted
技术标签:
【中文标题】从 ParaView 构建自定义 Qt 应用程序示例时出错【英文标题】:Error building custom Qt app examples from ParaView 【发布时间】:2019-11-25 13:47:41 【问题描述】:我正在研究制作一个基于 Qt 的桌面应用程序以使用 Paraview 框架并制作一个更简单的 ParaView GUI。文档说这里有一些例子
https://gitlab.kitware.com/paraview/paraview/tree/master/Examples/CustomApplications
在 ParaView 论坛我读到了这个
First, you need to build ParaView.
Then, choose one of the subfolder you points out: there all are independent examples. Build it in a new build directory. You will need to specify the path to the ParaView build directory in CMake with ParaView_DIR.
我构建了 ParaView,但我不理解这部分 You will need to specify the path to the ParaView build directory in CMake with ParaView_DIR.
这是我的结构
dev
|- pv
| |- build
| |- paraview-superbuild
|
|
|- qt-examples
|- one
|- build
|- Clone1
如何添加路径?
我尝试在 Clone1 的CMakeLists.txt
开头添加set(ParaView_DIR /Users/username/Desktop/dev/pv/build)
,然后从构建文件夹中执行cmake ../Clone1
。
但是出错了
CMake Error at CMakeLists.txt:6 (find_package):
By not providing "FindParaView.cmake" in CMAKE_MODULE_PATH this project has
asked CMake to find a package configuration file provided by "ParaView",
but CMake did not find one.
Could not find a package configuration file provided by "ParaView" with any
of the following names:
ParaViewConfig.cmake
paraview-config.cmake
Add the installation prefix of "ParaView" to CMAKE_PREFIX_PATH or set
"ParaView_DIR" to a directory containing one of the above files. If
"ParaView" provides a separate development package or SDK, be sure it has
been installed.
-- Configuring incomplete, errors occurred!
我需要做什么?
【问题讨论】:
错误消息中的ParaViewConfig.cmake
或paraview-config.cmake
是否存在于/Users/username/Desktop/dev/pv/build
中?
从discourse.paraview.org/t/executing-custom-applications-examples/…发帖,讨论正在进行中
你可能需要在你的paraview构建目录中做make install
,然后将安装目录传递给cmake,比如cmake -DParaView_DIR=/path/to/paraview-install
【参考方案1】:
好吧,错误消息说明了您需要做的所有事情。您需要设置变量CMAKE_PREFIX_PATH
指向您的构建路径。这可以在构建示例之一时在 cmake 命令行参数中完成:
cmake -DCMAKE_PREFIX_PATH=/Users/username/Desktop/dev/pv/build
当您尝试构建 Qt 程序时,您可能还需要设置 Qt 库的前缀路径。 CMAKE_PREFIX_PATH 是分号分隔的路径列表:
cmake -DCMAKE_PREFIX_PATH=/Users/username/Desktop/dev/pv/build;/Users/username/Qt/5.12.5/gcc_64
【讨论】:
按照 cmake 输出的建议,我发现使用<Project>_DIR
(或自 cmake 3.12 以来的 <Project>_ROOT
,请参阅 cmake.org/cmake/help/v3.16/variable/…)更清洁。 CMAKE_PREFIX_PATH
是某种具有副作用的全局变量。以上是关于从 ParaView 构建自定义 Qt 应用程序示例时出错的主要内容,如果未能解决你的问题,请参考以下文章