0

My very simple X.pro file looks like this:

TEMPLATE = lib

CONFIG += c++14 warn_on

HEADERS += x.hpp

target_headers.path  = $$[QT_SYSROOT]/usr/include/
target_headers.files = x.hpp
INSTALLS += target_headers

target_libs.path  = $$[QT_SYSROOT]/usr/lib/
target_libs.files = libX.so \
                    libX.so.1 \
                    libX.so.1.0 \
                    libX.so.1.0.0
target_libs.CONFIG += no_check_exist
INSTALLS += target_libs

The header file x.hpp can be left empty.

So, when I do

qmake
make 
make install

the header gets installed in /usr/include/, library in /usr/lib/.

This works fine when I use 32-bit compiler, since the libraries are supposed to be installed in /usr/lib/, but it is not fine when I use the 64-bit compiler, because the library should go to /usr/lib64/.

So, how do change the pro file, to configure where my library goes? Is there a way to detect whether a build is using 32bit or 64bit compiler?


Also, this is going to create 4 copies of the library, and not copy the links. How to fix that?

BЈовић
  • 62,405
  • 41
  • 173
  • 273

1 Answers1

1

Detect architecture: https://stackoverflow.com/a/30723860/1179842

contains(QT_ARCH, i386) {
    message("32-bit")
} else {
    message("64-bit")
}

Create links: Let qmake generate the commands for you: http://doc.qt.io/qt-5/qmake-advanced-usage.html#installing-files

target.path = $$[QT_SYSROOT]/usr/lib/
INSTALLS += target
SteakOverflow
  • 1,953
  • 13
  • 26