tags:

views:

188

answers:

2

I've a project with following files

TestProject/api/apiheader1.h
TestProject/api/apiheader2.h
TestProject/src/apiimplementaton.cpp
TestProject/inc/apiimplementation.h
TestProject/TestProject.pro

When the project TestProject.pro is built headers apiheader1.h, apiheader2.h needs to be copied to /usr/include/TestLib/. Is it possible to do this by specifying it in project file TestProject.pro.?

Any pointers / links will be helpful.

A: 

Are you sure that you want to move the files? Moving source files around feels wrong.

As for doing it using qmake, you can use the system() function to simply cp the files in question. http://pepper.troll.no/s60prereleases/doc/qmake-function-reference.html#system-command

e8johan
only headers are moved not the sources
Suresh
Not sure what your commenting, you control what you move using the cp call. As for my first comment, moving files at all during build feels akward. You can use the gcc -I argument (qmake variable INCLUDE_DIRS) to add more directories to look for headers in instead.Moving files means that you have to be extra careful when making changes and checking in things in your version control system.
e8johan
+1  A: 

You can add this to the pro file... in qmake you can add extra targets...The copyheaders will get run once the target is built..

QMAKE_EXTRA_TARGETS += copyheaders
POST_TARGETDEPS += copyheaders

copyheaders.commands += mkdir -p /usr/include/TestlLib
copyheaders.commands += cp -f PATH_TO_HEADERS/apiheader1.h /usr/include/TestLib
copyheaders.commands += cp -f PATH_TO_HEADERS/apiheader2.h /usr/include/TestLib

kriskarth