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. Qt6 - cmake
Forum Updated to NodeBB v4.3 + New Features

Qt6 - cmake

Scheduled Pinned Locked Moved Unsolved General and Desktop
14 Posts 5 Posters 5.2k Views 3 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.
  • rootshellR Offline
    rootshellR Offline
    rootshell
    wrote on last edited by
    #1

    Hello,
    Switching from Qt5 (qmake) to Qt6 (cmake), did a fresh install (removed Qt5).
    Creating a simple command line app
    Fails to accurately create a simple command line app
    The issue appears to be in CMakeLists.txt
    Change:
    find_package(Qt5Core)
    to:
    find_package(Qt6Core)

    I have googled my eyes out and have tried about everything I can think of...why is the CMakeLists still trying to use Qt5?

    Error in Qt Creator (Qt6 on mac):
    Running /Users/bryancairns/Qt/Tools/CMake/CMake.app/Contents/bin/cmake -S /Users/bryancairns/Documents/code/untitled5 -B /Users/bryancairns/Documents/code/build-untitled5-Desktop_Qt_6_0_0_clang_64bit-Debug in /Users/bryancairns/Documents/code/build-untitled5-Desktop_Qt_6_0_0_clang_64bit-Debug.
    -- Configuring done
    -- Generating done
    -- Build files have been written to: /Users/bryancairns/Documents/code/build-untitled5-Desktop_Qt_6_0_0_clang_64bit-Debug
    Elapsed time: 00:00.
    Running /Users/bryancairns/Qt/Tools/CMake/CMake.app/Contents/bin/cmake -S /Users/bryancairns/Documents/code/untitled6 -B /private/var/folders/q4/tqq65c7n635cxzfqchgbb86m0000gn/T/QtCreator-ksEaMJ/qtc-cmake-yiLmvJQC -GNinja -DCMAKE_BUILD_TYPE:String=Debug -DCMAKE_CXX_COMPILER:STRING=/usr/bin/clang++ -DCMAKE_C_COMPILER:STRING=/usr/bin/clang -DCMAKE_PREFIX_PATH:STRING=/Users/bryancairns/Qt/6.0.0/clang_64 -DQT_QMAKE_EXECUTABLE:STRING=/Users/bryancairns/Qt/6.0.0/clang_64/bin/qmake -DCMAKE_PREFIX_PATH:INTERNAL=/Users/bryancairns/Qt/6.0.0/clang_64 in /private/var/folders/q4/tqq65c7n635cxzfqchgbb86m0000gn/T/QtCreator-ksEaMJ/qtc-cmake-yiLmvJQC.
    -- The CXX compiler identification is AppleClang 12.0.0.12000032
    -- Detecting CXX compiler ABI info
    -- Detecting CXX compiler ABI info - done
    -- Check for working CXX compiler: /usr/bin/clang++ - skipped
    -- Detecting CXX compile features
    -- Detecting CXX compile features - done
    CMake Warning at CMakeLists.txt:14 (find_package):
    By not providing "FindQt5Core.cmake" in CMAKE_MODULE_PATH this project has
    asked CMake to find a package configuration file provided by "Qt5Core", but
    CMake did not find one.

    Could not find a package configuration file provided by "Qt5Core" with any
    of the following names:

    Qt5CoreConfig.cmake
    qt5core-config.cmake
    

    Add the installation prefix of "Qt5Core" to CMAKE_PREFIX_PATH or set
    "Qt5Core_DIR" to a directory containing one of the above files. If
    "Qt5Core" provides a separate development package or SDK, be sure it has
    been installed.

    -- Configuring done
    CMake Warning (dev) in CMakeLists.txt:
    AUTOGEN: No valid Qt version found for target untitled6. AUTOMOC, AUTOUIC
    and AUTORCC disabled. Consider adding:

    find_package(Qt<QTVERSION> COMPONENTS Widgets)
    

    to your CMakeLists.txt file.
    This warning is for project developers. Use -Wno-dev to suppress it.

    CMake Error at CMakeLists.txt:16 (add_executable):
    Target "untitled6" links to target "Qt::Core" but the target was not found.
    Perhaps a find_package() call is missing for an IMPORTED target, or an
    ALIAS target is missing?

    -- Generating done
    CMake Warning:
    Manually-specified variables were not used by the project:

    QT_QMAKE_EXECUTABLE
    

    CMake Generate step failed. Build files cannot be regenerated correctly.
    CMake process exited with exit code 1.
    Elapsed time: 00:00.

    Certifications: CISSP, MCITP, MCSE, MCSA, BA, AA, AG, CST, CNST, Linux+, Security+, Server+, Network+, A+, iNet+

    Languages: C++, C#, VB, Python, Java

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

      Hi,

      How did you install Qt 5 ?
      How did you install Qt 6 ?
      Do you have any custom software installed that makes use of Qt ?

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

      rootshellR 1 Reply Last reply
      0
      • SGaistS SGaist

        Hi,

        How did you install Qt 5 ?
        How did you install Qt 6 ?
        Do you have any custom software installed that makes use of Qt ?

        rootshellR Offline
        rootshellR Offline
        rootshell
        wrote on last edited by
        #3

        @SGaist Appreciate the response

        Qt5 was installed using the online installer and qmake
        Qt6 was installed using the online installer a cmake

        The Kit when installing Qt6 informed me i needed to upgrade cmake, I switched it to default to the cmake that came with Qt6.

        Im sure there are tons of programs on the box that use Qt, Im the only person using QtCreator to build software on the box.

        What ever is generating the CMakeLists.txt does not seem to detecting the version correctly.

        Certifications: CISSP, MCITP, MCSE, MCSA, BA, AA, AG, CST, CNST, Linux+, Security+, Server+, Network+, A+, iNet+

        Languages: C++, C#, VB, Python, Java

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

          Good, do you have any other Qt installed through e.g. macports or brew ?

          Could you test on the command line to see if you have the same issue ? I am just wondering whether Qt Creator may have some leftover settings interfering.

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

          rootshellR 1 Reply Last reply
          0
          • SGaistS SGaist

            Good, do you have any other Qt installed through e.g. macports or brew ?

            Could you test on the command line to see if you have the same issue ? I am just wondering whether Qt Creator may have some leftover settings interfering.

            rootshellR Offline
            rootshellR Offline
            rootshell
            wrote on last edited by
            #5

            @SGaist macports no, brew is installed and cmake listed
            I did brew uninstall cmake and verified it was gone

            same issue with QT / QTCreator generating CMakeLists.txt
            find_package(Qt5Core)

            Certifications: CISSP, MCITP, MCSE, MCSA, BA, AA, AG, CST, CNST, Linux+, Security+, Server+, Network+, A+, iNet+

            Languages: C++, C#, VB, Python, Java

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

              Ok, which Qt 6 release did you install exactly ?

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

              rootshellR 1 Reply Last reply
              0
              • SGaistS SGaist

                Ok, which Qt 6 release did you install exactly ?

                rootshellR Offline
                rootshellR Offline
                rootshell
                wrote on last edited by
                #7

                @SGaist

                The plot thickens...
                I just switched to my linux machine and name issue
                find_package(Qt5Core)

                Mac -
                I had removed Qt and did a fresh install.
                Newest Qt 6.0

                Linux -
                Have Qt 5.12. and and 15.5.0
                Ran the maintenance tool, updated all existing
                Reran - installed Qt 6.0
                Same issues on the linux box

                Certifications: CISSP, MCITP, MCSE, MCSA, BA, AA, AG, CST, CNST, Linux+, Security+, Server+, Network+, A+, iNet+

                Languages: C++, C#, VB, Python, Java

                rootshellR 1 Reply Last reply
                0
                • rootshellR rootshell

                  @SGaist

                  The plot thickens...
                  I just switched to my linux machine and name issue
                  find_package(Qt5Core)

                  Mac -
                  I had removed Qt and did a fresh install.
                  Newest Qt 6.0

                  Linux -
                  Have Qt 5.12. and and 15.5.0
                  Ran the maintenance tool, updated all existing
                  Reran - installed Qt 6.0
                  Same issues on the linux box

                  rootshellR Offline
                  rootshellR Offline
                  rootshell
                  wrote on last edited by
                  #8

                  @rootshell In case anyone is following this....
                  Removed it on Linux and had a fail trying to install
                  GUessing this has some rough edges, I will try to find out more.

                  Screenshot from 2020-12-08 16-05-20.png

                  Certifications: CISSP, MCITP, MCSE, MCSA, BA, AA, AG, CST, CNST, Linux+, Security+, Server+, Network+, A+, iNet+

                  Languages: C++, C#, VB, Python, Java

                  1 Reply Last reply
                  0
                  • Jonas KvingeJ Offline
                    Jonas KvingeJ Offline
                    Jonas Kvinge
                    wrote on last edited by
                    #9

                    @rootshell said in Qt6 - cmake:

                    CMakeLists.txt

                    Can you share your CMakeLists.txt file?
                    Are you sure you point to the correct source directory in the cmake command?

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

                      I just tested using cmake -DCMAKE_PREFIX_PATH=~/Qt/6.0.0/gcc_64/lib/cmake .. using one of Qt's example copied in a random folder and it worked properly nothing searched from Qt 5.

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

                      Tom assoT 1 Reply Last reply
                      0
                      • SGaistS SGaist

                        I just tested using cmake -DCMAKE_PREFIX_PATH=~/Qt/6.0.0/gcc_64/lib/cmake .. using one of Qt's example copied in a random folder and it worked properly nothing searched from Qt 5.

                        Tom assoT Offline
                        Tom assoT Offline
                        Tom asso
                        wrote on last edited by Tom asso
                        #11

                        @SGaist - I am having a very similar issue. Trying to port Qt5 to Qt6. on ubuntu 22.04.
                        I had previously installed Qt5 packages with apt install - I removed all of those with apt remove. I installed Qt6.7.2 with the online installer into directory ~/Qt6. Now cmake find_package() succeeds when I set CMAKE_PREFIX_PATH to ~/Qt6/6.7.2/gcc_64/lib/cmake/:

                        find_package(
                          Qt6
                          COMPONENTS Gui Widgets Quick
                          REQUIRED)
                        

                        But cmake fails on the target with:

                        CMake Warning (dev) in src/qt-test2/CMakeLists.txt:
                          AUTOGEN: No valid Qt version found for target qt-test.  AUTOMOC, AUTOUIC
                          and AUTORCC disabled.  Consider adding:
                        
                            find_package(Qt5 COMPONENTS Widgets)
                        
                          to your CMakeLists.txt file.
                        

                        What am I doing wrong?

                        Christian EhrlicherC 1 Reply Last reply
                        0
                        • Tom assoT Tom asso

                          @SGaist - I am having a very similar issue. Trying to port Qt5 to Qt6. on ubuntu 22.04.
                          I had previously installed Qt5 packages with apt install - I removed all of those with apt remove. I installed Qt6.7.2 with the online installer into directory ~/Qt6. Now cmake find_package() succeeds when I set CMAKE_PREFIX_PATH to ~/Qt6/6.7.2/gcc_64/lib/cmake/:

                          find_package(
                            Qt6
                            COMPONENTS Gui Widgets Quick
                            REQUIRED)
                          

                          But cmake fails on the target with:

                          CMake Warning (dev) in src/qt-test2/CMakeLists.txt:
                            AUTOGEN: No valid Qt version found for target qt-test.  AUTOMOC, AUTOUIC
                            and AUTORCC disabled.  Consider adding:
                          
                              find_package(Qt5 COMPONENTS Widgets)
                          
                            to your CMakeLists.txt file.
                          

                          What am I doing wrong?

                          Christian EhrlicherC Offline
                          Christian EhrlicherC Offline
                          Christian Ehrlicher
                          Lifetime Qt Champion
                          wrote on last edited by
                          #12

                          @Tom-asso Why do you hijack an old thread when you already have a topic with your issue here?

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

                          Tom assoT 1 Reply Last reply
                          0
                          • Christian EhrlicherC Christian Ehrlicher

                            @Tom-asso Why do you hijack an old thread when you already have a topic with your issue here?

                            Tom assoT Offline
                            Tom assoT Offline
                            Tom asso
                            wrote on last edited by
                            #13

                            @Christian-Ehrlicher - Not intending to hijack anything - this thread is very relevant to my current issue.

                            SGaistS 1 Reply Last reply
                            0
                            • Tom assoT Tom asso

                              @Christian-Ehrlicher - Not intending to hijack anything - this thread is very relevant to my current issue.

                              SGaistS Offline
                              SGaistS Offline
                              SGaist
                              Lifetime Qt Champion
                              wrote on last edited by
                              #14

                              @Tom-asso You can also use the qt-cmake wrapper from the bin folder of your Qt installation.

                              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

                              • Login

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