Search code examples
qtqt4makefile

how to export headers using Qt pro files


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.


Solution

  • 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