Install headers only .pro file



  • Dear members,
    I am trying to create a .pro file which should only install some header files in a specified directory without compiling or linking anything.
    Is there a simple way to do that ? Which kind of qmake template should I use ?
    Thanks in advance



  • If u r using qt creator then u can simply right click on the project-> select the Add Existing File and then select any file . It will include in the project.



  • Hi,
    The problem is that i want simply to install some template headers in a specific location. I tried to create a kind of dummy static library. However, in MacOSX at least, the system refuses to create a empty static library.
    I could in principle install the headers from the higher level .pro file but i would prefer to have a self-contained solution.



  • Here's how you can use qmake (in a .pro file) to copy files to the destination directory:

    "http://stackoverflow.com/q/3984104/1583123":http://stackoverflow.com/q/3984104/1583123

    You can also choose an arbitrary directory, by taking "this answer":http://stackoverflow.com/a/10058744/1583123 and changing DDIR to whatever directory you want.

    It'll look like this:
    @# Copies the given files to an arbitrary directory
    defineTest(copyToDir) {
    files = $$1

    for(FILE, files) {
        DDIR = C:\test
    
        # Replace slashes in paths with backslashes for Windows
        win32:FILE ~= s,/,\\,g
        win32:DDIR ~= s,/,\\,g
    
        QMAKE_POST_LINK += $$QMAKE_COPY $$quote($$FILE) $$quote($$DDIR) $$escape_expand(\\n\\t)
    }
    
    export(QMAKE_POST_LINK)
    

    }

    copyToDir(C:/YourProject/CopyTest/testHeader.h)@

    Also, note that the copy will only happen after the link step runs, which means the copy won't happen if you try to build and no link needs to be performed.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.