I have been trying in the last days to understand how qmake works buy I'm stuck. I want a project with the following structure:
root
- bin
- testjson
- lib
- libjson.so
- src
- testjson.cpp
All i wanted was to test the json library. I have created a new empty project in Qt Creator 2.3.0, and set up all the settings so the executable will run. Tested what I wanted and closed the application.
Later, when I opened Qt Creator again, I loaded the .pro file and surprise, when I try to run the project I get this message: "No executable specified." :| In this case I went to the project tab, and selected the executable manually but, as expected, when I tried to run it, I got this message "error while loading shared libraries: libjson.so: cannot open shared object file: No such file or directory". It was expected since the LD_LIBRARY_PATH is not set(it's like i'd run it from cli).
It looks like the .pro file isn't parsed properly because the 1st time, on the project tab when I was selectig Run tab, I'd see a message : "Parsing .pro file", and then the running config would get filled, and greyed out, so it means that the LD_LIBRARY_PATH was added by Qt Creator after parsing the .pro file.
Now my questing is: why was the .pro file parsed correctly 1st time?
Here's the .pro file:
!include(../../common.pri){
error(Couldn't find the common.pri file!)
}
TEMPLATE = app
SOURCES += testjson.cpp
CONFIG += console
TARGET = testjson
CONFIG(release, debug|release) {
DESTDIR = $$BinaryDir/Release
} else {
DESTDIR = $$BinaryDir/Debug
}
LIBS += -L$$LibraryDir -ljson
INCLUDEPATH += $$DefaultInclude
DEPENDPATH += $$LibraryDir
PS: The solution is to manually add the LD_LIBRARY_PATH to the building environment, but I find this not the right way to do it.