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. Qt5_DIR-NOTFOUND

Qt5_DIR-NOTFOUND

Scheduled Pinned Locked Moved Solved General and Desktop
13 Posts 3 Posters 18.8k 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.
  • F Offline
    F Offline
    Flaviu 0
    wrote on 18 Apr 2021, 15:51 last edited by
    #1

    I am trying to compile a github project for Qt, using CMake. Here is the settings:

    034c46ba-3dfb-47e5-a5b0-6c9a24c2014a-image.png ![alt text](image url)

    But I cannot setup a correct QT path: Qt5_DIR-NOTFOUND

    Here is the outcome message:

    CMake Error at CMakeLists.txt:32 (find_package):
      By not providing "FindQt5.cmake" in CMAKE_MODULE_PATH this project has
      asked CMake to find a package configuration file provided by "Qt5", but
      CMake did not find one.
    
      Could not find a package configuration file provided by "Qt5" with any of
      the following names:
    
        Qt5Config.cmake
        qt5-config.cmake
    
      Add the installation prefix of "Qt5" to CMAKE_PREFIX_PATH or set "Qt5_DIR"
      to a directory containing one of the above files.  If "Qt5" provides a
      separate development package or SDK, be sure it has been installed.
    

    I even setup Qt in PATH:

    1230d7db-242d-4457-ad56-811a3578602d-image.png

    I always got Qt5_DIR-NOTFOUND as feedback. What should I do in order to overcome this error ?

    1 Reply Last reply
    0
    • S Offline
      S Offline
      SGaist
      Lifetime Qt Champion
      wrote on 18 Apr 2021, 18:27 last edited by
      #2

      Hi,

      The PATH environment variable won't help there.

      @Flaviu-0 said in Qt5_DIR-NOTFOUND:

      Add the installation prefix of "Qt5" to CMAKE_PREFIX_PATH

      Define it to point to your Qt 5 installation as suggested when calling cmake.

      Or if you also have Qt Creator, just build it using it.

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

      F 1 Reply Last reply 18 Apr 2021, 19:39
      1
      • S SGaist
        18 Apr 2021, 18:27

        Hi,

        The PATH environment variable won't help there.

        @Flaviu-0 said in Qt5_DIR-NOTFOUND:

        Add the installation prefix of "Qt5" to CMAKE_PREFIX_PATH

        Define it to point to your Qt 5 installation as suggested when calling cmake.

        Or if you also have Qt Creator, just build it using it.

        F Offline
        F Offline
        Flaviu 0
        wrote on 18 Apr 2021, 19:39 last edited by
        #3

        @SGaist
        Yes, I have used Qt Creator to compile with CMake, specifically, I have loaded CMakeLists.tzt into Qt Creator, but there I have another troubles:

        Run Build Command(s):C:/Project/ninja-win/ninja.exe cmTC_df434 && [1/2] Building C object CMakeFiles\cmTC_df434.dir\testCCompiler.c.obj
            [2/2] Linking C executable cmTC_df434.exe
            FAILED: cmTC_df434.exe 
            cmd.exe /C "cd . && "C:\Program Files\CMake\bin\cmake.exe" -E vs_link_exe --intdir=CMakeFiles\cmTC_df434.dir --rc=rc --mt=CMAKE_MT-NOTFOUND --manifests  -- C:\PROGRA~2\MICROS~1.0\VC\bin\X86_AM~1\link.exe /nologo CMakeFiles\cmTC_df434.dir\testCCompiler.c.obj  /out:cmTC_df434.exe /implib:cmTC_df434.lib /pdb:cmTC_df434.pdb /version:0.0 /machine:x64  /debug /INCREMENTAL /subsystem:console  kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib && cd ."
            RC Pass 1: command "rc /fo CMakeFiles\cmTC_df434.dir/manifest.res CMakeFiles\cmTC_df434.dir/manifest.rc" failed (exit code 0) with the following output:
            The system cannot find the file specified
            ninja: build stopped: subcommand failed.
        

        I guess the CMake way it is the easy one.

        1 Reply Last reply
        0
        • S Offline
          S Offline
          SGaist
          Lifetime Qt Champion
          wrote on 18 Apr 2021, 20:16 last edited by
          #4

          Your build started correctly.

          Qt Creator uses cmake since it's a cmake project. The main difference is that the paths for Qt are pre-configured so you do not have to worry about that.

          What is failing here is the rc call. How does your CMakeFile.txt look like ?

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

          F 1 Reply Last reply 19 Apr 2021, 12:52
          1
          • S SGaist
            18 Apr 2021, 20:16

            Your build started correctly.

            Qt Creator uses cmake since it's a cmake project. The main difference is that the paths for Qt are pre-configured so you do not have to worry about that.

            What is failing here is the rc call. How does your CMakeFile.txt look like ?

            F Offline
            F Offline
            Flaviu 0
            wrote on 19 Apr 2021, 12:52 last edited by Flaviu 0
            #5

            @SGaist

            In fact, is about this CMakeLists.txt: https://github.com/cnr-isti-vclab/meshlab/blob/master/src/CMakeLists.txt

            1 Reply Last reply
            0
            • F Offline
              F Offline
              Flaviu 0
              wrote on 20 Apr 2021, 07:56 last edited by
              #6

              Any hint will be very helpful to me.

              1 Reply Last reply
              0
              • S Offline
                S Offline
                SGaist
                Lifetime Qt Champion
                wrote on 20 Apr 2021, 08:29 last edited by
                #7

                It's the rc part that fails. Did you a fresh build from start ?

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

                F 1 Reply Last reply 20 Apr 2021, 12:54
                1
                • S SGaist
                  20 Apr 2021, 08:29

                  It's the rc part that fails. Did you a fresh build from start ?

                  F Offline
                  F Offline
                  Flaviu 0
                  wrote on 20 Apr 2021, 12:54 last edited by
                  #8

                  @SGaist Thank you a lot. I have succeeded into compiling that project, using CMake and VS2017.

                  1 Reply Last reply
                  0
                  • S Offline
                    S Offline
                    SGaist
                    Lifetime Qt Champion
                    wrote on 20 Apr 2021, 18:45 last edited by
                    #9

                    You're welcome !

                    What did you do to succeed ?

                    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
                    • F Offline
                      F Offline
                      Flaviu 0
                      wrote on 22 Apr 2021, 09:19 last edited by
                      #10

                      I have generated VS2017 solution file using CMake, but I get out Qt option, so I am not using Qt right now, just VS2017. Now, I can compile, run and debug reliable this project. Thank you a lot for your support.

                      1 Reply Last reply
                      0
                      • F Offline
                        F Offline
                        Flaviu 0
                        wrote on 26 Apr 2021, 18:34 last edited by
                        #11

                        And another information for those who have the same issue, I noticed that CMake chooses Qt5_DIR with this values:

                        b3287b72-9ec4-482f-a89b-50e4384d1235-image.png C:/Qt/Qt5.12.10/5.12.10/msvc2017_64/lib/cmake/Qt5

                        Hope it helps.

                        1 Reply Last reply
                        1
                        • Z Offline
                          Z Offline
                          ZacDu
                          wrote on 15 May 2024, 03:07 last edited by
                          #12

                          It's really helpful. Thanks a lot.

                          1 Reply Last reply
                          0
                          • Z Offline
                            Z Offline
                            ZacDu
                            wrote on 15 May 2024, 03:24 last edited by ZacDu
                            #13

                            image.png

                            The above image is a successful CMake settings. I am trying to compile the VTK. Now 33% done. I hope I made it.

                            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