CMake doesn't know where is Qt4 qmake

后端 未结 8 1505
自闭症患者
自闭症患者 2021-02-04 00:05

I am using Debian OS and I\'m trying to point to cmake where is my Qt4.

I try to build qjson library and with its CMakeLists.txt: http://pastebin.com/fKNp0Qgy

I

相关标签:
8条回答
  • 2021-02-04 00:28

    1) Where is your qtchooser configuration file?

      $: locate qtchooser | grep conf
    

    2) From the list of conf files, probably there is one call "default.conf" This one is a link to one of the others (4.conf or qt4.conf or 5.conf or qt5.conf). Choose the one that makes sense too you, and create a link to it.

    Suppose your default file path is

    /usr/lib/x86_64-linux-gnu/qt-default/qtchooser/default.conf

    Create backup:

      $: cd $(dirname /usr/lib/x86_64-linux-gnu/qt-default/qtchooser/default.conf)
      $: cp -av default.conf default.conf_backup
    

    Let's say you target is /usr/lib/x86_64-linux-gnu/qtchooser/qt5.conf

    Then:

      $: sudo ln -s /usr/lib/x86_64-linux-gnu/qtchooser/qt5.conf default.conf
    

    3) Is the path to your qmake right?

    Check qmake location

      $: locate qmake | grep bin
    

    Is the same one as indicated in your modified qtchooser/default.conf?

      $: cat /usr/lib/x86_64-linux-gnu/qtchooser/qt5.conf
    

    If the answer is YES, then you are done. If the anser is no, then you need to modify the file:

    Create backup:

      $: cd $(dirname /usr/lib/x86_64-linux-gnu/qtchooser/qt5.conf)
      $: cp -av qt5.conf qt5.conf_backup
    

    Edit file and change path to your qmake location

      $ sudo vi qt5.conf
    

    Now it should be done.

    0 讨论(0)
  • 2021-02-04 00:37

    In my case it was just that qtchooser was missing the "default" configuration. I figured cmake is just executing qtchooser and looking for a "default" configuration file name. You can install any configuration file by doing the following:

    qtchooser -install <arbitrary_name> <path_to_qmake>
    

    In my case I simply provided "default" as the arbitrary name... this created the default.conf file in the appropriate locations and all is well. I don't think there is a limit to how many named versions of qt you have. If you do this as root it should work for all users.

    0 讨论(0)
  • 2021-02-04 00:39

    In my experience, this problem is most easily solved by putting the folder containing qmake in your PATH environment variable.

    0 讨论(0)
  • 2021-02-04 00:40

    just try "sudo apt-get install qt-sdk" it works for me

    0 讨论(0)
  • 2021-02-04 00:40

    I solved my problem.

    Looking for QT_SELECT with grep command I found that QT_SELECT is related to /usr/lib/x86_64-linux-gnu/qt-default/qtchooser/default.conf file. From the "default" file name I assumed that it is what is seen as QT_SELECT. Other configs presented with qtchooser -l are in /usr/share/qtchooser/ and /usr/lib/x86_64-linux-gnu/qtchooser directories.

    Such a config file has two lines with paths. I just changed these lines, first pointing to my Qt bin directory and second pointing to my Qt lib directory. Then I could see that qtchooser -print-env shows QTTOOLDIR and QTLIBDIR to my Qt.

    Then I could easily build qjson library with CMake, Qt4 was found correctly.

    0 讨论(0)
  • 2021-02-04 00:41

    On my old RHEL distro, this did it for me:

    sudo yum install qt-devel.x86_64
    

    Just the qt-base one wouldn't work with cmake.

    0 讨论(0)
提交回复
热议问题