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. Creating QML plugin for QSensor
Qt 6.11 is out! See what's new in the release blog

Creating QML plugin for QSensor

Scheduled Pinned Locked Moved Solved General and Desktop
3 Posts 2 Posters 347 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.
  • S Offline
    S Offline
    sven9
    wrote on last edited by
    #1

    Hi everyone,

    I'm trying to build a QML plugin for a QSensor.
    Following this blog post: https://www.qt.io/blog/qml-modules-in-qt-6.2 I managed to create a QML plugin based on QObject.

    But when I add

    target_link_libraries(mylib PRIVATE Qt6::Sensors)
    

    to the CMakeLists.txt of the plugin I end up with the error message:

    <path>/lib/cmake/Qt6Core/Qt6CoreMacros.cmake:617: error: get_target_property() called with non-existent target "Qt6::Sensors". <path>/lib/cmake/Qt6Core/Qt6CoreMacros.cmake:705 (_qt_internal_finalize_executable) <path>/lib/cmake/Qt6Core/Qt6CoreMacros.cmake:685:EVAL:1 (qt6_finalize_target) CMakeLists.txt:DEFERRED
    

    When the target is an executable linking the Qt6::Sensors library works fine.

    Can anybody help me solve this?

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

      Hi and welcome to devnet,

      Might be a silly question but do you have something along the lines of:

      find_package(Qt6 REQUIRED COMPONENTS Sensors)
      

      in your plugin project ?

      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
      • S Offline
        S Offline
        sven9
        wrote on last edited by
        #3

        Actually this did help. Thanks a lot.

        I had

        find_package(Qt6 6.2
            REQUIRED COMPONENTS Sensors
        )
        

        in the CMakeLists.txt of the plugin but after adding 'Sensors' to the 'REQUIRED COMPONENTS' in the CMakeLists.txt of the project using the plugin it works now.

        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