1. <tfoot id='CAvtd'></tfoot>

        <bdo id='CAvtd'></bdo><ul id='CAvtd'></ul>
    2. <small id='CAvtd'></small><noframes id='CAvtd'>

      <legend id='CAvtd'><style id='CAvtd'><dir id='CAvtd'><q id='CAvtd'></q></dir></style></legend>

      1. <i id='CAvtd'><tr id='CAvtd'><dt id='CAvtd'><q id='CAvtd'><span id='CAvtd'><b id='CAvtd'><form id='CAvtd'><ins id='CAvtd'></ins><ul id='CAvtd'></ul><sub id='CAvtd'></sub></form><legend id='CAvtd'></legend><bdo id='CAvtd'><pre id='CAvtd'><center id='CAvtd'></center></pre></bdo></b><th id='CAvtd'></th></span></q></dt></tr></i><div id='CAvtd'><tfoot id='CAvtd'></tfoot><dl id='CAvtd'><fieldset id='CAvtd'></fieldset></dl></div>

        如何在 Windows 上找到 Qt5 CMake 模块

        时间:2023-10-05

        <small id='Tc4Nm'></small><noframes id='Tc4Nm'>

          <tbody id='Tc4Nm'></tbody>
        <i id='Tc4Nm'><tr id='Tc4Nm'><dt id='Tc4Nm'><q id='Tc4Nm'><span id='Tc4Nm'><b id='Tc4Nm'><form id='Tc4Nm'><ins id='Tc4Nm'></ins><ul id='Tc4Nm'></ul><sub id='Tc4Nm'></sub></form><legend id='Tc4Nm'></legend><bdo id='Tc4Nm'><pre id='Tc4Nm'><center id='Tc4Nm'></center></pre></bdo></b><th id='Tc4Nm'></th></span></q></dt></tr></i><div id='Tc4Nm'><tfoot id='Tc4Nm'></tfoot><dl id='Tc4Nm'><fieldset id='Tc4Nm'></fieldset></dl></div>

          <tfoot id='Tc4Nm'></tfoot><legend id='Tc4Nm'><style id='Tc4Nm'><dir id='Tc4Nm'><q id='Tc4Nm'></q></dir></style></legend>
              <bdo id='Tc4Nm'></bdo><ul id='Tc4Nm'></ul>
                • 本文介绍了如何在 Windows 上找到 Qt5 CMake 模块的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  我正在尝试在 Windows 上使用 CMake 制作一个非常基本的 Qt5 应用程序.我使用 Qt5 的文档 使用 CMake,而我的 main.cpp 文件只包含一个 main 函数.

                  I'm trying to make a very basic Qt5 application using CMake on Windows. I used the documentation of Qt5 to use CMake, and my main.cpp file just contains a main function.

                  我的 CMakeLists.txt 正是:

                  cmake_minimum_required(VERSION 2.8.9)
                  
                  project(testproject)
                  
                  # Find includes in corresponding build directories
                  set(CMAKE_INCLUDE_CURRENT_DIR ON)
                  # Instruct CMake to run moc automatically when needed.
                  set(CMAKE_AUTOMOC ON)
                  
                  # Find the QtWidgets library
                  find_package(Qt5Widgets)
                  
                  # Tell CMake to create the helloworld executable
                  add_executable(helloworld hello.cpp)
                  
                  # Use the Widgets module from Qt 5.
                  qt5_use_modules(helloworld Widgets)
                  

                  当我在 MSysGit bash 中输入

                  When in MSysGit bash I enter

                  $ cmake -G"Visual Studio 11"
                  

                  我得到这个输出:

                  $ cmake -G"Visual Studio 11"
                  -- The C compiler identification is MSVC 17.0.60204.1
                  -- The CXX compiler identification is MSVC 17.0.60204.1
                  -- Check for working C compiler using: Visual Studio 11
                  -- Check for working C compiler using: Visual Studio 11 -- works
                  -- Detecting C compiler ABI info
                  -- Detecting C compiler ABI info - done
                  -- Check for working CXX compiler using: Visual Studio 11
                  -- Check for working CXX compiler using: Visual Studio 11 -- works
                  -- Detecting CXX compiler ABI info
                  -- Detecting CXX compiler ABI info - done
                  CMake Warning at CMakeLists.txt:11 (find_package):
                    By not providing "FindQt5Widgets.cmake" in CMAKE_MODULE_PATH this project
                    has asked CMake to find a package configuration file provided by
                    "Qt5Widgets", but CMake did not find one.
                  
                    Could not find a package configuration file provided by "Qt5Widgets" with
                    any of the following names:
                  
                      Qt5WidgetsConfig.cmake
                      qt5widgets-config.cmake
                  
                    Add the installation prefix of "Qt5Widgets" to CMAKE_PREFIX_PATH or set
                    "Qt5Widgets_DIR" to a directory containing one of the above files.  If
                    "Qt5Widgets" provides a separate development package or SDK, be sure it has
                    been installed.
                  
                  
                  CMake Error at CMakeLists.txt:17 (qt5_use_modules):
                    Unknown CMake command "qt5_use_modules".
                  
                  
                  -- Configuring incomplete, errors occurred!
                  

                  你有什么想法吗?

                  推荐答案

                  行后

                  cmake_minimum_required(VERSION 2.8.9)
                  
                  project(testproject)
                  

                  添加

                  set (CMAKE_PREFIX_PATH "C:\Qt\Qt5.0.1\5.0.1\msvc2010\")
                  

                  这就解决了问题.

                  这篇关于如何在 Windows 上找到 Qt5 CMake 模块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:本机 C++ 属性的可移植性 下一篇:警告 C4003 以及错误 C2589 和 C2059 在:x = std::numeri

                  相关文章

                  最新文章

                  1. <small id='YafxB'></small><noframes id='YafxB'>

                  2. <tfoot id='YafxB'></tfoot>
                      <bdo id='YafxB'></bdo><ul id='YafxB'></ul>
                      <i id='YafxB'><tr id='YafxB'><dt id='YafxB'><q id='YafxB'><span id='YafxB'><b id='YafxB'><form id='YafxB'><ins id='YafxB'></ins><ul id='YafxB'></ul><sub id='YafxB'></sub></form><legend id='YafxB'></legend><bdo id='YafxB'><pre id='YafxB'><center id='YafxB'></center></pre></bdo></b><th id='YafxB'></th></span></q></dt></tr></i><div id='YafxB'><tfoot id='YafxB'></tfoot><dl id='YafxB'><fieldset id='YafxB'></fieldset></dl></div>
                    1. <legend id='YafxB'><style id='YafxB'><dir id='YafxB'><q id='YafxB'></q></dir></style></legend>