首先查看此报错信息位置:
/.../VTKSource/GUISupport/QtQuick/qml/CMakeLists.txt
打开文件,查看关联代码段:
# First, find the qmlplugindump executable
get_target_property(qt_qmake_location "Qt${vtk_qt_major_version}::qmake" LOCATION)
get_filename_component(qt_bin_dir "${qt_qmake_location}" PATH)
if (APPLE)
get_filename_component(qt_bin_dir "${qt_bin_dir}" PATH)
endif ()
find_program(QMLPLUGINDUMP_EXECUTABLE
NAMES "qmlplugindump-qt${vtk_qt_major_version}" qmlplugindump
HINTS "${qt_bin_dir}"
DOC "QmlPlugindump executable location")
mark_as_advanced(QMLPLUGINDUMP_EXECUTABLE)
if (NOT QMLPLUGINDUMP_EXECUTABLE)
message(FATAL_ERROR
"qmlplugindump executable not found.\nIt is required to generate the "
"qmltypes file for VTK Qml plugin.")
endif ()
从这里看执行的流程,就是通过 qt_qmake_location 找到 qt_bin_dir ,再从qt_bin_dir 中找 qmlplugindump 这个可执行文件 。
打开Qt的安装目录,搜索qmlplugindump的可执行文件,找到文件在这里
/Users/.../Qt/5.15.2/clang_64/bin
直接在CMakeList.txt中添加一句,完成之后的代码段:
# First, find the qmlplugindump executable
get_target_property(qt_qmake_location "Qt${vtk_qt_major_version}::qmake" LOCATION)
get_filename_component(qt_bin_dir "${qt_qmake_location}" PATH)
if (APPLE)
get_filename_component(qt_bin_dir "${qt_bin_dir}" PATH)
endif ()
set( qt_bin_dir "/Users/allen/Soft/Qt/5.15.2/clang_64/bin/" )
find_program(QMLPLUGINDUMP_EXECUTABLE
NAMES "qmlplugindump-qt${vtk_qt_major_version}" qmlplugindump
HINTS "${qt_bin_dir}"
DOC "QmlPlugindump executable location")
mark_as_advanced(QMLPLUGINDUMP_EXECUTABLE)
if (NOT QMLPLUGINDUMP_EXECUTABLE)
message(FATAL_ERROR
"qmlplugindump executable not found.\nIt is required to generate the "
"qmltypes file for VTK Qml plugin.")
endif ()
然后继续configure -- generate -- make 即可。
遇到什么问题,直接找到问题相关的代码,然后从源头进行解决即可。