qmake and QT_INSTALL_PREFIX. How can I select a new location for Qt library?

后端 未结 3 1999
猫巷女王i
猫巷女王i 2021-02-12 23:29

I am new to qmake and I am trying to build an existing application. Qt was originally installed in /usr/local/lib/Qt-4.3.5 and \'qmake -query QT_INSTALL_PREFIX\' returns that pa

3条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2021-02-12 23:50

    As pointed out by Henrik Hartz, QT_INSTALL_PREFIX is built-in and can't be changed. However, if you just want to work around having to rebuild Qt temporarily, then you can try the following:

    Query qmake for it's install prefix, recreate the reported directory structure, and use a symlink or hardlink to where the relocated Qt version is. E.g. on Linux

    • Get the path reported by /new/Qt/location/bin/qmake -query QT_INSTALL_PREFIX. Say this reports /Parent/Dirs/Prefix.
    • Create any parent directories of the path, e.g. mkdir -p /Parent/Dirs/
    • Symlink to new location, e.g. ln -s /new/Qt/location /Parent/Dirs/Prefix

    The above can be also useful if you have a bunch of developers who need to work with the same prebuilt version of Qt, where this Qt version isn't necessarily copied to the same path on all the developers' computers, and where you only need to bundle the Qt shared libs with you application for end users (i.e. you won't be shipping headers or build tools).

提交回复
热议问题