I have a project wihich should build a shared library and a test program for it. I have created a project:
Qt Code:
  1. TEMPLATE = subdirs
  2.  
  3. SUBDIRS += \
  4. library \
  5. exe
  6.  
  7. exe.depends = library
To copy to clipboard, switch view to plain text mode 
a library project:
Qt Code:
  1. TEMPLATE = lib
  2. TARGET = mylib
  3. QT = core
  4. QMAKE_CXXFLAGS += -std=c++11
  5. INCLUDEPATH += hpp
  6. DEPENDPATH += hpp
  7.  
  8. HEADERS += \
  9. ...
  10.  
  11. SOURCES += \
  12. ...
To copy to clipboard, switch view to plain text mode 
and the test program project exe:
Qt Code:
  1. TEMPLATE = app
  2. QT = core
  3. TARGET = myapp
  4. QMAKE_CXXFLAGS += -std=c++11
  5. INCLUDEPATH += ../library/hpp hpp
  6. DEPENDPATH += ../library/hpp hpp
  7. LIBS += -L../library -lmylib
  8.  
  9. HEADERS += \
  10. ...
  11.  
  12. SOURCES += \
  13. ...
To copy to clipboard, switch view to plain text mode 
This seems to compile. Headers, both in library/hpp and exe/hpp, seem to be found, both libmylib.so and myapp are sitting in their folders, no errors or warnings are reported. But it will not run. IMO, the problem is in the library location.of libmylib.so, is not found at runtime. The problem is that there will be two libmylib.so in the end: one in debug build, one in release build. That's why I do not want to play with LD_LIBRARY_PATH. Is there some option which would say the executable loader where is libmylib.so in the case of debug build and where it is in the case in release build? And a question in advance:

This project is made as a preparation for dynamic linking shared objects using QLibrary. Which is the best (temporary, before the .so is placed on the libpath) way of specifying the correct path for libmylib.so?