Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-1714

eval() does not expand variables correctly

    XMLWordPrintable

Details

    Description

      Consider the following snippet from a .pro file, which qmake is run on to generate a Makefile:

      HEADERS += foo.h
      
      for(headerFile, HEADERS) {
          baseName = $$basename(headerFile)
      
          TARGET_HEADER_DIR = $$PWD
          TARGET_NAME =$${TARGET_HEADER_DIR}/../$${baseName} # destination directory
      
          eval($${baseName}.target = $${TARGET_NAME})
          eval($${baseName}.commands = cp $${headerFile} $${TARGET_NAME})
          eval($${baseName}.depends = $${headerFile})
      
          HEADER_TARGETS += $${baseName}
          HEADER_DEPENDS += $${TARGET_NAME}
      }
      
      includes.depends = $${HEADER_DEPENDS}
      QMAKE_EXTRA_TARGETS += includes $${HEADER_TARGETS}
      

      The expected result is a Makefile with the following target:

      /home/sthomassen/tasks/190000/199626/../foo.h: foo.h
              cp foo.h /home/sthomassen/tasks/190000/199626/../foo.h
      

      The actual result is the following target, in which eval($${baseName}.depends = $${headerFile}) did not expand $${headerFile} correctly:

      /home/sthomassen/tasks/190000/199626/../foo.h: /home/sthomassen/tasks/190000/199626/../foo.h
              cp foo.h /home/sthomassen/tasks/190000/199626/../foo.h
      

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            stormols Marius Storm-Olsen
            sthomass Stian Sandvik Thomassen (closed Nokia identity) (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes