Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Install headers only .pro file

Install headers only .pro file

Scheduled Pinned Locked Moved General and Desktop
4 Posts 3 Posters 2.2k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    armando.navarro
    wrote on last edited by
    #1

    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

    1 Reply Last reply
    0
    • A Offline
      A Offline
      ankursaxena
      wrote on last edited by
      #2

      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.

      1 Reply Last reply
      0
      • A Offline
        A Offline
        armando.navarro
        wrote on last edited by
        #3

        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.

        1 Reply Last reply
        0
        • A Offline
          A Offline
          adolby
          wrote on last edited by
          #4

          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.

          1 Reply Last reply
          0

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved