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. using find_package() of cmake in QtCreator
Forum Updated to NodeBB v4.3 + New Features

using find_package() of cmake in QtCreator

Scheduled Pinned Locked Moved Unsolved Qt Creator and other tools
11 Posts 4 Posters 4.5k Views 2 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.
  • B Offline
    B Offline
    Bazinevis
    wrote on last edited by
    #1

    I am using Qt Creator to work on a project that is using cmake. I want to use find_package() function of cmake to find Qt5Core and other Qt related libraries. My problem is when I use find_package(Qt5Core) library, QtCreator adds a entry in projects pane that is a relative path to .cmake config files. I try to show this with pictures. I use a simple program to do this.

    This is QtCreator before using find_package() in root cmake file:
    alt text

    This is QtCreator after using find_package() in root cmake file:
    alt text

    I hope that this is clear explanation. How can I disable this feature in QtCreator?

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

      Hi and welcome to devnet,

      You should add which version of Qt Creator and Qt you are using.

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

        Thanks for your reply.
        I was using Qt 5.9.0 and QtCreator 4.3.0 which is the latest Qt. Then I test this on other computer by installing QtCreator 4.3.0 (becuase this version of QtCreator is the best) and installing Qt libraries from repository. But nothing changed and I had that problem too.
        This annoying problem occurs in older versions of QtCreator too.

        This is a picture of QtCreator 3.5.1 that has this problem too:
        alt text

        By the way I am using Kubuntu 16.04 LTS and 64bit machine.

        Also this is the minimal example that I used to show the problem. (here)

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

          When you say you are installing Qt from repository, do you mean from your distribution package management ?

          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
          • B Offline
            B Offline
            Bazinevis
            wrote on last edited by
            #5

            Yes I mean installing from distribution package management.
            I also installed the latest Qt .run file from Qt.io website that had this problem.
            I make a project by creating the main.cc and CMakeLists.txt file that I uploaded and using QtCreator to open the CMakeLists.txt file.
            Did you test that? I had this problem on my older computer too.
            For some libraries like liblua5.2, when I use find_pakage(Lua) nothing adds to the projects pane but when I use find_package(Qt5Core) it adds path to .cmake config files.

            1 Reply Last reply
            0
            • B Offline
              B Offline
              Bazinevis
              wrote on last edited by Bazinevis
              #6

              Hi again
              When I install and use Qt4 libraries using cmake command: find_package(Qt4 COMPONENTS QTCORE QTGUI REQUIRED), everything works fine and nothing adds to the projects pane.
              I hope this helps to solve the problem in future version of qtcreator.
              Thanks.

              M 1 Reply Last reply
              0
              • B Bazinevis

                Hi again
                When I install and use Qt4 libraries using cmake command: find_package(Qt4 COMPONENTS QTCORE QTGUI REQUIRED), everything works fine and nothing adds to the projects pane.
                I hope this helps to solve the problem in future version of qtcreator.
                Thanks.

                M Offline
                M Offline
                mchinand
                wrote on last edited by
                #7

                Do you have the Qt5 you want to use set up as a 'Kit' in QtCreator? If you type 'which qmake' on the command line, what does it print out? I think setting the correct Kit will take care of it, but you can also try setting QTDIR to the appropriate Qt version's bin directory in your CMakeLists.txt file (e.g., SET(QTDIR "/home/myhomefolder/MyQt5/bin") ).

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

                  Qt Creator 4.3.1 just got released with work that has been done on the cmake side. You should check it.

                  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
                  • B Offline
                    B Offline
                    Bazinevis
                    wrote on last edited by Bazinevis
                    #9

                    Hi
                    I checked out QtCreator 4.3.1 but I think it's cmake support is a mess.
                    QtCreator had a very robust cmake support in the past but I think those days are gone.

                    Look what happens when I create a simple non-qt project using QtCreator:
                    alt text

                    alt text

                    alt text

                    alt text

                    alt text

                    Look at project view. Even for a simple cmake project there are many annoying entries that I don't want.
                    I just want a simple project view that shows my folders and source files in tree like structure.
                    When I import my cmake project which is a big project in Qtcreatro 4.3.1 I can't handle it. QtCreator shows me cmake targets and split headers and sources in "<Source Directory>" and "<Headers>" folders.

                    jsulmJ 1 Reply Last reply
                    0
                    • B Bazinevis

                      Hi
                      I checked out QtCreator 4.3.1 but I think it's cmake support is a mess.
                      QtCreator had a very robust cmake support in the past but I think those days are gone.

                      Look what happens when I create a simple non-qt project using QtCreator:
                      alt text

                      alt text

                      alt text

                      alt text

                      alt text

                      Look at project view. Even for a simple cmake project there are many annoying entries that I don't want.
                      I just want a simple project view that shows my folders and source files in tree like structure.
                      When I import my cmake project which is a big project in Qtcreatro 4.3.1 I can't handle it. QtCreator shows me cmake targets and split headers and sources in "<Source Directory>" and "<Headers>" folders.

                      jsulmJ Offline
                      jsulmJ Offline
                      jsulm
                      Lifetime Qt Champion
                      wrote on last edited by
                      #10

                      @Bazinevis You can switch from "Projects" to "File System" view

                      https://forum.qt.io/topic/113070/qt-code-of-conduct

                      1 Reply Last reply
                      0
                      • B Offline
                        B Offline
                        Bazinevis
                        wrote on last edited by
                        #11

                        I tried to use FileSystem view but it doesn't have tree structure like project view has. Every time I want to expand a folder I have to open that folder. Besides that using FileSystem view and switching between files is annoying.

                        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