One can find a lot of examples where QMAKE_LIBDIR is used to specify additional library directories.
The Qt manual says:
QMAKE_LIBDIR
Specifies a list of system library paths. The value of this variable is typically handled by qmake or qmake.conf and rarely needs to be modified.
Up to now I always used "unix: -L$$(LIB_DIR) -l" or similar whenever I wanted to use an external library in one of my projects and didn't want to use the library wizard.
Can I conclude that specifying a path via -L is discouraged even if there is no corresponding statement within the manual? (According to this post it is discouraged - but why?)
Thanks in advance.
Building a Project For simple projects, you only need to run qmake in the top level directory of your project to generate a Makefile. You can then run your platform's make tool to build the project according to the Makefile.
pwd stands for Print Working Directory. It prints the path of the working directory, starting from the root. pwd is shell built-in command(pwd) or an actual binary(/bin/pwd). $PWD is an environment variable which stores the path of the current directory.
CMake is an alternative to qmake for automating the generation of build configurations. Setting Up Qbs. Qbs is an all-in-one build tool that generates a build graph from a high-level project description (like qmake or CMake do) and executes the commands in the low-level build graph (like make does).
In a way there's a corresponding statement. Put your -Lpath/to/dir
into the LIBS
variable:
http://doc.qt.io/qt-5/qmake-variable-reference.html#libs
LIBS
Specifies a list of libraries to be linked into the project. If you use the Unix -l (library) and -L (library path) flags, qmake handles the libraries correctly on Windows (that is, passes the full path of the library to the linker). The library must exist for qmake to find the directory where a -l lib is located.
For example:
unix:LIBS += -L/usr/local/lib -lmath
win32:LIBS += c:/mylibs/math.lib
So, using -L
within LIBS
is actually encouraged by the Qt docs
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With