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. QMake: Automatically running a command after qmake generates Makefile

QMake: Automatically running a command after qmake generates Makefile

Scheduled Pinned Locked Moved General and Desktop
5 Posts 3 Posters 6.8k Views
  • 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.
  • U Offline
    U Offline
    UrsusExplorans
    wrote on 17 Dec 2010, 12:00 last edited by
    #1

    Hello,

    I'd like to run a shell command automatically after running qmake generating the Makefile. Is this possible? I checked documentation (only found @system()@ function, which is called before the Makefile is written) and Google did not come up with a suitable answer, either.

    The reason why I ask is that the generated Makefiles automatically contain @-L/usr/lib/@ in the @LIBS@ variable (yes, i'm working with linux). Thereby I get an old version linked into my project, which is globally installed and since i'm not root, i cannot remove it.

    My idea was to automatically change the makefile after running qmake and delete the entry in the LIBS variable with a command such as @sed -i 's/-L/usr/lib/ /g' Makefile@. If I do it manually, everything gets linked correctly.

    Does anybody have an idea how to do this? Or another way to fix this problem? Resorting LD_LIBRARY_PATH or PKG_CONFIG_PATH does not have any effect. qmake seems to always puts this directory in first place an there seems to be no easy way to remove it.

    Thank in advance!

    Best,
    Eckard

    1 Reply Last reply
    0
    • A Offline
      A Offline
      alexander
      wrote on 17 Dec 2010, 12:04 last edited by
      #2

      try @QMAKE_PRE_LINK@ and @QMAKE_POST_LINK@

      1 Reply Last reply
      0
      • A Offline
        A Offline
        alexander
        wrote on 17 Dec 2010, 12:05 last edited by
        #3

        "http://colby.id.au/node/145":http://colby.id.au/node/145

        1 Reply Last reply
        0
        • U Offline
          U Offline
          UrsusExplorans
          wrote on 17 Dec 2010, 12:39 last edited by
          #4

          The problem with the both preceding answers is that the command modifying the Makefile gets evaluated when the Makefile is already being processed. It gets modified but the changes won't make effect, since the Makefile won't be read again before the linking process. The second answer works if I call make two times. It does not work the first time for the given reason.

          Is there a way to execute the command by qmake after the Makefile has been generated?

          Or perhaps is there a completely different way to get rid of this "-L/usr/lib" entry?

          Nevertheless, thank you very much so far! :-)

          1 Reply Last reply
          0
          • J Offline
            J Offline
            JulienMaille
            wrote on 14 Feb 2011, 19:24 last edited by
            #5

            I'm also looking for a way to run system() command after the creation of the makfile/vcproj.
            I can't believe there is now way to achieve this!

            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