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. Can not set QTSDK DIRs within QTCreator
Qt 6.11 is out! See what's new in the release blog

Can not set QTSDK DIRs within QTCreator

Scheduled Pinned Locked Moved Unsolved Qt Creator and other tools
12 Posts 4 Posters 1.3k 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.
  • A Offline
    A Offline
    Allon
    wrote on last edited by Allon
    #1

    Hi,
    Here is my compilation parameters screen:
    4290d85a-4db0-4b33-b1e1-677a00b046d2-image.png
    I have installed qt5_15_2 qt sdk on my linux and want to use the cmake files from QTSDK and not from my distribution.
    I can not find a way to do it except changing all the xxx_DIR one by one (here I have set Qt5_DIR by hand).
    Could someone tell me if there is a value to change to autodetect the files into QTSDK?
    Thanks a lots in advance,
    Emmanuel

    1 Reply Last reply
    0
    • sierdzioS Offline
      sierdzioS Offline
      sierdzio
      Moderators
      wrote on last edited by
      #2

      You need to add this Qt version in Qt Creator settings, then create a new Kit based on it. There is absolutely no need to provide any paths other than the path to qmake.

      (Z(:^

      A 1 Reply Last reply
      2
      • cristian-adamC Offline
        cristian-adamC Offline
        cristian-adam
        wrote on last edited by
        #3

        What value do you have for the CMake variable CMAKE_PREFIX_PATH?

        Otherwise CMake has the --debug-find which prints information about the find_package calls and the locations where it looks for packages.

        A 1 Reply Last reply
        0
        • sierdzioS sierdzio

          You need to add this Qt version in Qt Creator settings, then create a new Kit based on it. There is absolutely no need to provide any paths other than the path to qmake.

          A Offline
          A Offline
          Allon
          wrote on last edited by
          #4

          @sierdzio It is already autorecognised, I think the problem comes from cmake setting.

          1 Reply Last reply
          0
          • cristian-adamC cristian-adam

            What value do you have for the CMake variable CMAKE_PREFIX_PATH?

            Otherwise CMake has the --debug-find which prints information about the find_package calls and the locations where it looks for packages.

            A Offline
            A Offline
            Allon
            wrote on last edited by
            #5

            @cristian-adam HI,
            Thanks for your answer.
            I set it here:
            72698d81-89da-4f1a-98ec-1eb353252896-image.png
            In QtCreator parameters.
            Regards,
            Emmanuel

            1 Reply Last reply
            0
            • cristian-adamC Offline
              cristian-adamC Offline
              cristian-adam
              wrote on last edited by
              #6

              For the CMAKE_PREFIX_PATH you only need the path without lib/cmake since CMake is adding that automagically, see https://cmake.org/cmake/help/latest/command/find_package.html#config-mode-search-procedure

              You can set CMAKE_IGNORE_PATH to /usr/x86_64-linux-gnu/ but that might not find other CMake packages in the system.

              CMake's --debug-find is your friend here, you can find out what CMake is doing by analyzing the output.

              A 1 Reply Last reply
              0
              • cristian-adamC cristian-adam

                For the CMAKE_PREFIX_PATH you only need the path without lib/cmake since CMake is adding that automagically, see https://cmake.org/cmake/help/latest/command/find_package.html#config-mode-search-procedure

                You can set CMAKE_IGNORE_PATH to /usr/x86_64-linux-gnu/ but that might not find other CMake packages in the system.

                CMake's --debug-find is your friend here, you can find out what CMake is doing by analyzing the output.

                A Offline
                A Offline
                Allon
                wrote on last edited by
                #7

                @cristian-adam said in Can not set QTSDK DIRs within QTCreator:

                /usr/x86_64-linux-gn

                Thanks a lot for your help. I will have time on wednesday to work furthur on my problem and will let you posted of my progress.
                Emmanuel

                1 Reply Last reply
                1
                • A Offline
                  A Offline
                  Allon
                  wrote on last edited by
                  #8

                  Hi,
                  When running in command line, everything is fine:
                  CMake Debug Log at /home/charruau/Qt5_15_2/5.15.2/gcc_64/lib/cmake/Qt5Network/Qt5NetworkConfig.cmake:99 (find_package):
                  /home/charruau/Qt5_15_2/5.15.2/gcc_64/lib/cmake/Qt5Core/Qt5CoreConfig.cmake

                  Call Stack (most recent call first):
                  /home/charruau/Qt5_15_2/5.15.2/gcc_64/lib/cmake/Qt5Qml/Qt5QmlConfig.cmake:99 (find_package)
                  /home/charruau/Qt5_15_2/5.15.2/gcc_64/lib/cmake/Qt5/Qt5Config.cmake:28 (find_package)
                  CMakeLists.txt:102 (find_package)

                  It is pointing to the right libs.

                  I am still not able to do the same within QTCreator :(

                  882af9bf-5ea9-488c-b8c7-c20569c1db3e-image.png

                  574a8e33-7c1d-4848-9e18-514894307334-image.png

                  QTCreator is still point at libs within /usr !

                  1 Reply Last reply
                  0
                  • cristian-adamC Offline
                    cristian-adamC Offline
                    cristian-adam
                    wrote on last edited by
                    #9

                    You can import a console build in Qt Creator, and use that configuration.

                    But Qt Creator when it configures a project does the same thing that you would do from command line. A clean build or "Re-configure with initial parameters" should fix the issue.

                    1 Reply Last reply
                    0
                    • Z Offline
                      Z Offline
                      ziller
                      wrote on last edited by
                      #10

                      Just a note, since this is a behavior that I myself regularly stumble over:

                      If you have an existing build, with an existing CMakeCache.txt, and that detected a framework like Qt but a version that you didn't want, if just change the CMAKE_PREFIX_PATH to something else and re-run CMake, it will not re-detect the framework with the new cmake prefix path. It already found the framework, so it doesn't re-detect. You have to remove the CMakeCache.txt first, then call CMake with the new CMAKE_PREFIX_PATH to force it to re-detect the different version.

                      A 1 Reply Last reply
                      1
                      • Z ziller

                        Just a note, since this is a behavior that I myself regularly stumble over:

                        If you have an existing build, with an existing CMakeCache.txt, and that detected a framework like Qt but a version that you didn't want, if just change the CMAKE_PREFIX_PATH to something else and re-run CMake, it will not re-detect the framework with the new cmake prefix path. It already found the framework, so it doesn't re-detect. You have to remove the CMakeCache.txt first, then call CMake with the new CMAKE_PREFIX_PATH to force it to re-detect the different version.

                        A Offline
                        A Offline
                        Allon
                        wrote on last edited by
                        #11

                        @ziller I removed the CMakeCache.txt.
                        Somehow now it is compiling, but I can not know what I did.
                        But I am quite sure I need still to resolve the following problem.
                        All my qt dirs
                        0855d556-3d18-4b76-bdaa-92d6e27390e5-image.png
                        are pointing to the distro files.
                        I would like them to be my qt sdk one, example:
                        /home/charruau/Qt5_15_2/5.15.2/gcc_64/lib/cmake/Qt5Core/ for QT5_Core.
                        How do you do to do this?
                        My cmake_prefix_path is pointing to the right place.
                        cmake_install_prefix is not doing anything.
                        Thanks in advance

                        1 Reply Last reply
                        0
                        • cristian-adamC Offline
                          cristian-adamC Offline
                          cristian-adam
                          wrote on last edited by
                          #12

                          I can only assume that you have a Kit that doesn't have the Qt SDK selected as the Qt version and you configure with an empty CMAKE_PREFIX_PATH and then CMake picks up your system Qt.

                          Then you tried changing the CMAKE_PREFIX_PATH in the Current configuration and not the Initial Configuration, but that only changes the CMAKE_PREFIX_PATH cache variable and not all the Qt5*_DIR cache variables.

                          I have made a screencast showcasing this case: https://bugreports.qt.io/secure/attachment/128619/QtCreator-7.0.2-Linux-system-vs-qtsdk.mp4

                          Make sure that your Kit contains the right Qt version and / or that you change the Initial Configuration value of CMAKE_PREFIX_PATH.

                          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