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. Get QtPlatformHeaders include path with Cmake
Forum Updated to NodeBB v4.3 + New Features

Get QtPlatformHeaders include path with Cmake

Scheduled Pinned Locked Moved Solved General and Desktop
4 Posts 2 Posters 346 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.
  • G Offline
    G Offline
    glennr
    wrote on last edited by
    #1

    I am wanting to use a class from QtPlatformHeaders:

    #include <QtPlatformHeaders/QCocoaNativeContext>
    

    and I need to do this from CMake.

    How do I get CMake to include the right path in the generated build files so that the above #include will work?

    I'm including the main Qt5 packages is like this:

    find_package(Qt5 COMPONENTS Widgets Gui REQUIRED)
    
    1 Reply Last reply
    0
    • Christian EhrlicherC Offline
      Christian EhrlicherC Offline
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @glennr said in Get QtPlatformHeaders include path with Cmake:

      so that the above #include will work?

      It will work the way you did it according to the docs.

      Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
      Visit the Qt Academy at https://academy.qt.io/catalog

      G 1 Reply Last reply
      0
      • Christian EhrlicherC Christian Ehrlicher

        @glennr said in Get QtPlatformHeaders include path with Cmake:

        so that the above #include will work?

        It will work the way you did it according to the docs.

        G Offline
        G Offline
        glennr
        wrote on last edited by
        #3

        @Christian-Ehrlicher said in Get QtPlatformHeaders include path with Cmake:

        @glennr said in Get QtPlatformHeaders include path with Cmake:

        so that the above #include will work?

        It will work the way you did it according to the docs.

        Except it doesn't, hence the question.

        I need to somehow tell CMake how to set the proper include path. The relevant documentation is here https://doc.qt.io/qt-5/cmake-manual.html but it doesn't specifically say how to set the include path for QtPlatformHeaders.

        1 Reply Last reply
        0
        • G Offline
          G Offline
          glennr
          wrote on last edited by
          #4

          Solved it like this:

          execute_process(
              COMMAND qmake -query QT_INSTALL_HEADERS
              OUTPUT_VARIABLE Qt5_INCLUDE_DIR
              )
          
          include_directories(${Qt5_INCLUDE_DIR})
          
          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