Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. How to add Qt Bluetooth module to CMake?
Qt 6.11 is out! See what's new in the release blog

How to add Qt Bluetooth module to CMake?

Scheduled Pinned Locked Moved Solved General and Desktop
9 Posts 3 Posters 9.0k Views 1 Watching
  • 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.
  • C Offline
    C Offline
    Celal
    wrote on last edited by
    #1

    I am not able to add activate Bluetooth module to add cmake file.

    the line in cmakefile

    find_package(Qt5 COMPONENTS Widgets Qml Quick Bluetooth REQUIRED)
    

    error

    /usr/lib/x86_64-linux-gnu/cmake/Qt5/Qt5Config.cmake:26: error: Could not find a package configuration file provided by "Qt5Bluetooth" with any of the following names: Qt5BluetoothConfig.cmake qt5bluetooth-config.cmake Add the installation prefix of "Qt5Bluetooth" to CMAKE_PREFIX_PATH or set "Qt5Bluetooth_DIR" to a directory containing one of the above files.  If "Qt5Bluetooth" provides a separate development package or SDK, be sure it has been installed. qt_demo/CMakeLists.txt:20 (find_package)
    
    
    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      Maybe a silly question but did you install the qtconnectivity5-dev (or your distribution equivalent) package ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      1
      • C Offline
        C Offline
        Celal
        wrote on last edited by
        #3

        @SGaist said in How to add Qt Bluetooth module to CMake?:

        qtconnectivity5

        :) yes, it was the issue, but It does not make sense to me. I installed Qt with maintenance tool, and I am able to compile code with .pro configuration. Any idea?

        Now, there is another problem.

        new error

        error: QtBluetooth/qtbluetooth-config.h: No such file or directory
         #include <QtBluetooth/qtbluetooth-config.h>
                                                    ^
        

        thanks in advance

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          What version did you install ?

          Where are you calling cmake from ?

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          0
          • C Offline
            C Offline
            Celal
            wrote on last edited by
            #5

            I have 5.10.1 installed under /opt/Qt/5.10.1

            I am calling cmake from Qt creator.

            1 Reply Last reply
            0
            • SGaistS Offline
              SGaistS Offline
              SGaist
              Lifetime Qt Champion
              wrote on last edited by
              #6

              What version of cmake are you using ?

              Interested in AI ? www.idiap.ch
              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

              C 1 Reply Last reply
              0
              • SGaistS SGaist

                What version of cmake are you using ?

                C Offline
                C Offline
                Celal
                wrote on last edited by
                #7

                @SGaist

                cmake version 3.5.1

                1 Reply Last reply
                0
                • C Offline
                  C Offline
                  Celal
                  wrote on last edited by
                  #8

                  There is something wrong with my IDE, when I compile from command line everything works.

                  SGaist, thank you for your help, for now, I am going to flag this thread as Solved.

                  1 Reply Last reply
                  0
                  • S Offline
                    S Offline
                    SherifOmran
                    wrote on last edited by
                    #9

                    i know this is an old thread but I am replying for any body in future searching for it

                    add the following to your cmake file

                    target_link_libraries(project
                      PRIVATE Qt5::Core Qt5::Quick Qt5::Bluetooth )
                    
                    1 Reply Last reply
                    0

                    • Login

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