PDA

View Full Version : pass code from .pro file through to Makefile in qmake?



rholsen
16th October 2008, 15:11
New to Qt programming so not sure if I'm missing something obvious....

Is there a way to have qmake pass code through from a .pro file to the generated Makefile?

We have a rather complicated development environment and I would like to have a couple of
"include /path_to/my_make_include_file"
statements in the generated Makefile, without having to edit the file by hand after running qmake.

Thanks!

bbui210
16th October 2008, 18:29
Is there a way to have qmake pass code through from a .pro file to the generated Makefile?

We have a rather complicated development environment and I would like to have a couple of
"include /path_to/my_make_include_file"
statements in the generated Makefile, without having to edit the file by hand after running qmake.


Yes, in the qmake Manual (http://doc.trolltech.com/4.4/qmake-manual.html) under the project files section, it tells you how to declare other libraries and include paths:



Excerpt from manual:


If you are using other libraries in your project in addition to those supplied with Qt, you need to specify them in your project file.

The paths that qmake searches for libraries and the specific libraries to link against can be added to the list of values in the LIBS variable. The paths to the libraries themselves can be given, or the familiar Unix-style notation for specifying libraries and paths can be used if preferred.

For example, the following lines show how a library can be specified:

LIBS += -L/usr/local/lib -lmath

The paths containing header files can also be specified in a similar way using the INCLUDEPATH variable.

For example, it is possible to add several paths to be searched for header files:

INCLUDEPATH = c:/msdev/include d:/stl/include

rholsen
16th October 2008, 18:51
Yes, in the qmake Manual (http://doc.trolltech.com/4.4/qmake-manual.html) under the project files section, it tells you how to declare other libraries and include paths:



Excerpt from manual:

I did notice that in the manual and am using it to expand my INCLUDE and LIB paths and specify C code includes, etc. Works great. But what I would like to do is have an actual "include" statement in the generated Makefile. I am using clearcase and clearmake which allows one to include additional makefile code from external files by saying "include filename.inc". I would like to pass that "include" directive through from the .pro file without any intermediate modification by qmake. In other words, I want to include makefile directives, variables, etc. that qmake just passes through.

It's beginning to look like I must code make rules to mimic what qmake does with moc, etc., and just use our regular make.

Just wanted to know if there was an easier way, because qmake does some neat things.