I think your code is failing because you're not accounting for the paths within
the build directory.
When you use shadow builds and your projects are contained within a subdir,
everything is built under the same directory so you just have to make sure your
paths are relative to that build output. Example:
I have to projects in a subdir. 'MyLib' is a static lib:
CONFIG(debug, debug|release) {
OBJECTS_DIR = ./Debug
} else {
OBJECTS_DIR = ./Release
}
CONFIG += debug_and_release
DESTDIR = $${OBJECTS_DIR}
This ensures that the lib is built in a directory called Debug or Release
depending on the configuration.
I have a unit test, MyTest, an executable that links against MyLib.a:
_LIB_PATH = ../MyLib/${OBJECTS_DIR}
LIBS += -L$${_LIB_PATH} -lMyLib
PRE_TARGETDEPS += $${_LIB_PATH}libMyLib.a
This code will work with shadow builds because both MyLib and MyTest are built
to the same directory tree. MyTest simply navigates up one level from it's
output directory to find the MyLib directory. This contains the library binary
under a directory with the same name as a the configuration (OBJECTS_DIR).
The _LIB_PATH variable is just a convenience and the PRE_TARGETDEPS ensures the
library is re-linked by MyTest when it changes.
This example is from OSX and I might be missing a few things because QMake is
something of a black art. If you need an working example I can make you one.
On 23 Sep 2010, at 21:54, Matthias Pospiech wrote:
> I experience so frequently problems with shadow builds that I switch them off
> by default.
> However I understand the principle behind the shadow builds and would also
> like to understand
> how to get my project working with shadow builds.
>
> Here is what I do: A project which creates a lib which is later linked in the
> example.
>
> /project/example/
> /project/fftw/32/libfftw3-3.a <- the lib file I want to link against
> /project/src/ <- my own libary code, containing src.pro
>
> I am using subdirs. In src.pro I am using this code to link:
> LIBS += -L../lib/fftw/32/ -lfftw3-3
>
> which _fails_ with shadow builds
>
> If I use this code:
> LIBS += -L../lib/other/fftw/32/libfftw3-3.a
> then it does not complain about not finding the lib file.
> However non of the containing functions are found. Which means it was no
> linked.
>
> without shadow builds everything works as expected.
>
> Solutions of this problem are welcome,
> however any solution requiring an absolute path c:\user\.... is a no go.
>
> Matthias
>
>
>
>
>
>
> _______________________________________________
> Qt-creator mailing list
> [email protected]
> http://lists.trolltech.com/mailman/listinfo/qt-creator
_______________________________________________
Qt-creator mailing list
[email protected]
http://lists.trolltech.com/mailman/listinfo/qt-creator