我正在努力解决以下问题,我真的希望有人能为我提供有用的提示。
使用CMake 3.8.2构建基于Qt5.8的C ++应用程序时,在"生成"期间出现以下错误:步骤:
CMake Error at ntActions/ntActionsITK/CMakeLists.txt:81 (ADD_LIBRARY):
Target "ntActionsITK" links to target "Qt5::X11Extras" but the target
was not found. Perhaps a find_package() call is missing for an IMPORTED
target, or an ALIAS target is missing?
这些是我的CMakeLists的两行,问题出现了:
80 - ADD_DEFINITIONS(-DQT_GUI_LIBS -DQT_CORE_LIB -DQT3_SUPPORT)
81 - ADD_LIBRARY(ntActions ${ntActionsGUI_SRCS} ${ntActions_GUI}
我的PATH变量包括QT5.8安装路径(lib,lib / CMake,bin,include)。 CMake能够自动查找我正在使用的所有Qt5软件包,包括Qt5X11Extras。
我错过了什么吗?
我的开发环境如下:Debian 8,Qt(5.8),CMake(3.8.2)
任何帮助将不胜感激
由于 布巴
ADD:qt5Setup.cmake file
您好Tsyvarev,感谢您的反馈。我有一个qt5Setup.cmake文件来设置Qt5,如下所示:
find_package(Qt5 COMPONENTS Core Widgets Gui Network Concurrent OpenGL
Svg PrintSupport Sql SerialPort MultimediaWidgets X11Extras)
IF(QT_USE_FILE)
INCLUDE(${QT_USE_FILE})
ENDIF(QT_USE_FILE)
include_directories(
${Qt5Core_INCLUDE_DIRS}
${Qt5Widgets_INCLUDE_DIRS}
${Qt5Gui_INCLUDE_DIRS}
${Qt5Network_INCLUDE_DIRS}
${Qt5OpenGL_INCLUDE_DIRS}
${Qt5Svg_INCLUDE_DIRS}
${Qt5Concurrent_INCLUDE_DIRS}
${Qt5PrintSupport_INCLUDE_DIRS}
${Qt5Sql_INCLUDE_DIRS}
${QtSerialPort_INCLUDE_DIRS}
${Qt5MultimediaWidgets_INCLUDE_DIRS}
${Qt5X11Extras_INCLUDE_DIRS})
LINK_LIBRARIES(
${Qt5Svg_LIBRARIES}
${Qt5Network_LIBRARIES}
${Qt5Widget_LIBRARIES}
${Qt5Sql_LIBRARIES}
${QtSerialPort_LIBRARIES}
${Qt5MultimediaWidgets_LIBRARIES}
${Qt5PrintSupport_LIBRARIES}
${Qt5X11Extras_LIBRARIES})