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

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

        <bdo id='fGNKu'></bdo><ul id='fGNKu'></ul>
      1. <tfoot id='fGNKu'></tfoot>
        <i id='fGNKu'><tr id='fGNKu'><dt id='fGNKu'><q id='fGNKu'><span id='fGNKu'><b id='fGNKu'><form id='fGNKu'><ins id='fGNKu'></ins><ul id='fGNKu'></ul><sub id='fGNKu'></sub></form><legend id='fGNKu'></legend><bdo id='fGNKu'><pre id='fGNKu'><center id='fGNKu'></center></pre></bdo></b><th id='fGNKu'></th></span></q></dt></tr></i><div id='fGNKu'><tfoot id='fGNKu'></tfoot><dl id='fGNKu'><fieldset id='fGNKu'></fieldset></dl></div>
      2. 如何在 Windows 上找到 Qt5 CMake 模块

        时间:2023-07-02
        • <small id='OTSGx'></small><noframes id='OTSGx'>

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

            1. <legend id='OTSGx'><style id='OTSGx'><dir id='OTSGx'><q id='OTSGx'></q></dir></style></legend>

                  <tbody id='OTSGx'></tbody>
                <tfoot id='OTSGx'></tfoot>

                • 本文介绍了如何在 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 模块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

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

                  相关文章

                  • <bdo id='rdF9H'></bdo><ul id='rdF9H'></ul>

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