{"id":1340,"date":"2022-08-30T15:15:43","date_gmt":"2022-08-30T15:15:43","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2013\/11\/10\/how-to-find-qt5-cmake-module-on-windows-collection-of-common-programming-errors\/"},"modified":"2022-08-30T15:15:43","modified_gmt":"2022-08-30T15:15:43","slug":"how-to-find-qt5-cmake-module-on-windows-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2022\/08\/30\/how-to-find-qt5-cmake-module-on-windows-collection-of-common-programming-errors\/","title":{"rendered":"How to find qt5 CMake module on windows-Collection of common programming errors"},"content":{"rendered":"<p>I&#8217;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.<\/p>\n<p>My CMakeLists.txt is exactly :<\/p>\n<pre><code>cmake_minimum_required(VERSION 2.8.9)\n\nproject(testproject)\n<\/code><\/pre>\n<p><strong>EDIT solution<\/strong><\/p>\n<pre><code>set (CMAKE_PREFIX_PATH \"C:\\\\Qt\\\\Qt5.0.1\\\\5.0.1\\\\msvc2010\\\\\")\n<\/code><\/pre>\n<p><strong>end EDIT<\/strong><\/p>\n<pre><code># Find includes in corresponding build directories\nset(CMAKE_INCLUDE_CURRENT_DIR ON)\n# Instruct CMake to run moc automatically when needed.\nset(CMAKE_AUTOMOC ON)\n\n# Find the QtWidgets library\nfind_package(Qt5Widgets)\n\n# Tell CMake to create the helloworld executable\nadd_executable(helloworld hello.cpp)\n\n# Use the Widgets module from Qt 5.\nqt5_use_modules(helloworld Widgets)\n<\/code><\/pre>\n<p>When in MSysGit bash I enter `$ cmake -G&#8221;Visual Studio 11&#8243;<\/p>\n<p>I get this output:<\/p>\n<pre><code>$ cmake -G\"Visual Studio 11\"\n-- The C compiler identification is MSVC 17.0.60204.1\n-- The CXX compiler identification is MSVC 17.0.60204.1\n-- Check for working C compiler using: Visual Studio 11\n-- Check for working C compiler using: Visual Studio 11 -- works\n-- Detecting C compiler ABI info\n-- Detecting C compiler ABI info - done\n-- Check for working CXX compiler using: Visual Studio 11\n-- Check for working CXX compiler using: Visual Studio 11 -- works\n-- Detecting CXX compiler ABI info\n-- Detecting CXX compiler ABI info - done\nCMake Warning at CMakeLists.txt:11 (find_package):\n  By not providing \"FindQt5Widgets.cmake\" in CMAKE_MODULE_PATH this project\n  has asked CMake to find a package configuration file provided by\n  \"Qt5Widgets\", but CMake did not find one.\n\n  Could not find a package configuration file provided by \"Qt5Widgets\" with\n  any of the following names:\n\n    Qt5WidgetsConfig.cmake\n    qt5widgets-config.cmake\n\n  Add the installation prefix of \"Qt5Widgets\" to CMAKE_PREFIX_PATH or set\n  \"Qt5Widgets_DIR\" to a directory containing one of the above files.  If\n  \"Qt5Widgets\" provides a separate development package or SDK, be sure it has\n  been installed.\n\n\nCMake Error at CMakeLists.txt:17 (qt5_use_modules):\n  Unknown CMake command \"qt5_use_modules\".\n\n\n-- Configuring incomplete, errors occurred!\n<\/code><\/pre>\n<p>Do you have any ideas ?<\/p>\n<p>thank you in advance.<\/p>\n<p id=\"rop\"><small>Originally posted 2013-11-10 00:45:09. <\/small><\/p>","protected":false},"excerpt":{"rendered":"<p>I&#8217;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. My CMakeLists.txt is exactly : cmake_minimum_required(VERSION 2.8.9) project(testproject) EDIT solution set (CMAKE_PREFIX_PATH &#8220;C:\\\\Qt\\\\Qt5.0.1\\\\5.0.1\\\\msvc2010\\\\&#8221;) end EDIT # Find includes in corresponding build directories set(CMAKE_INCLUDE_CURRENT_DIR ON) [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-1340","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/1340","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=1340"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/1340\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=1340"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=1340"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=1340"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}