Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt Creator and other tools
  4. CMake find_package problem
Forum Update on Monday, May 27th 2025

CMake find_package problem

Scheduled Pinned Locked Moved Solved Qt Creator and other tools
3 Posts 2 Posters 385 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    Perdrix
    wrote on 12 Feb 2025, 10:11 last edited by
    #1

    I'm trying a build a third party project which uses CMake on Windows using a Visual Studio command prompt.

    But when I did so I got this:

    D:\Github\SmtpClient-for-Qt>cmake -B ./build -G Ninja -DBUILD_SHARED_LIBS=OFF -DCMAKE_PREFIX_PATH:STRING="C:\Qt\6.8.2\msvc2022_64"
    CMake Error at CMakeLists.txt:16 (find_package):
      Could not find a configuration file for package "Qt" that is compatible
      with requested version "".
    
      The following configuration files were considered but not accepted:
    
        C:/Qt/6.8.2/msvc2022_64/lib/cmake/Qt6/Qt6Config.cmake, version: 6.8.2 (64bit)
    
    -- Configuring incomplete, errors occurred!
    

    lines 16 and 17 of the CMakeLists file read:

    find_package(Qt NAMES Qt6 COMPONENTS Core Network REQUIRED)
    find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Core Network REQUIRED)
    

    What is wrong please?

    1 Reply Last reply
    0
    • C Offline
      C Offline
      cristian-adam
      wrote on 13 Feb 2025, 06:50 last edited by
      #2

      You are using the wrong Visual Studio command prompt. Very likely the x86 version, and not the x86_64 one.

      This part:

      The following configuration files were considered but not accepted:
      
          C:/Qt/6.8.2/msvc2022_64/lib/cmake/Qt6/Qt6Config.cmake, version: 6.8.2 (64bit)
      

      gave it away.

      1 Reply Last reply
      2
      • P Offline
        P Offline
        Perdrix
        wrote on 13 Feb 2025, 10:20 last edited by
        #3

        Oh my goodness, that was so not obvious (to me) ... Thank you!

        David

        1 Reply Last reply
        1
        • P Perdrix has marked this topic as solved on 13 Feb 2025, 10:21

        2/3

        13 Feb 2025, 06:50

        • Login

        • Login or register to search.
        2 out of 3
        • First post
          2/3
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved