[Interest] Help a unix guy on windows qmake

Elvis Stansvik elvstone at gmail.com
Wed Apr 21 21:59:54 CEST 2021


Den ons 21 apr. 2021 kl 20:43 skrev Elvis Stansvik <elvstone at gmail.com>:
>
> Den ons 21 apr. 2021 kl 19:49 skrev Jason H <jhihn at gmx.com>:
> >
> >
> >
> > > Sent: Wednesday, April 21, 2021 at 1:14 PM
> > > From: "Thiago Macieira" <thiago.macieira at intel.com>
> > > To: interest at qt-project.org
> > > Subject: Re: [Interest] Help a unix guy on windows qmake
> > >
> > > On Wednesday, 21 April 2021 09:54:09 PDT Jason H wrote:
> > > > Now, when compiling, regardless of shadow build or not, refer to the libs by
> > > > adding to the project: +++ project.pro
> > > > + mingw {
> > > > +     INCLUDEPATH += $PROJ/libraries/win/include
> > > > +     LIBS += -L$PROJ/libraries/win/$ARCH -lvendor
> > > > + }
> > > >
> > > > It seems that $PWD ${PWD} or whatever ($${PWD}?) refer to the build dir, be
> > > > it shadow or not. I don't want to copy the libraries to the shadow dir in
> > > > QMAKE_PRE_LINK because they *never* change.
> > >
> > > You're mixing environment variables and qmake variables. Qmake variables
> > > always start with a double dollar sign and are expanded by qmake when it
> > > writes the Makefile output. You can see their value with message().
> > >
> > > qmake does not expand environment variables at all.
> > >
> > > $ X=A qmake Y=b /dev/stdin -o /dev/null <<<'message(r = $X $$Y)'
> > > Project MESSAGE: r = $X b
> > >
> > > The environment variables are written as-is to your Makefile. It's up to you
> > > to write something that make will understand.
> > >
> > > $PROJ is not a valid environment variable expansion in Make.
> >
> >
> > Right. I used $PROJ for illustrative purposes. I guess the flaw in my thinking
> > is that when the shadow build is made, that there is some way to reference the
> > original location( other than ../project_name
> >
> > Maybe all I need is:
> > PROJ=../project
>
> I think you'd need to use $$_PRO_FILE_PWD_ for it to work in a shadow build (?)
>
> E.g. assuming
>
> $PROJ/project.pro
> $PROJ/libraries/win/include/mylib.h
> $PROJ/libraries/win/x64/mylib.lib
>
> Something like
>
> mingw {
>     INCLUDEPATH += $$_PRO_FILE_PWD_/libraries/win/include
>     LIBS += $$_PRO_FILE_PWD_/libraries/win/x64
> }

Scratch my suggestion and just use $$PWD. I had misunderstood that variable.

The docs for it says it all: "Specifies the full path leading to the
directory containing the current file being parsed. This can be useful
to refer to files within the source tree when writing project files to
support shadow builds.", which sounds like what you need (and as
suggested by Jérôme in his mail.

Elvis

>
> Elvis
>
> >
> > Thank you for example. Very enlightening.
> > _______________________________________________
> > Interest mailing list
> > Interest at qt-project.org
> > https://lists.qt-project.org/listinfo/interest


More information about the Interest mailing list