Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt Creator and other tools
  4. Using the system function in qmake
Forum Updated to NodeBB v4.3 + New Features

Using the system function in qmake

Scheduled Pinned Locked Moved Qt Creator and other tools
4 Posts 3 Posters 4.8k 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.
  • D Offline
    D Offline
    DannyK
    wrote on last edited by
    #1

    I was trying to run the system command in qmake and execute a perl one liner.

    Would anyone know what this command is not properly interpreted by qmake version 4?

    @CMD2 = $$system(perl -MCwd -MFile::Basename -MFile::Spec -e '$=&getcwd();while($ ne "/"){if( -e File::Spec->catfile($,"rules.make")){print $;last;} $=dirname($);} ' )
    message("CMD " $${CMD2} )
    @

    I accidentally used qmake version 3 and it ran fine.

    Any help would be greatly appreciated.
    DannyK

    [Edit: Removed double posting /Vass]

    1 Reply Last reply
    0
    • V Offline
      V Offline
      vsorokin
      wrote on last edited by
      #2

      Welcome to Qt Developer Network
      You can edit your post, double posting not needed. Use 'edit' link under your userpic and name.

      --
      Vasiliy

      1 Reply Last reply
      0
      • G Offline
        G Offline
        goetz
        wrote on last edited by
        #3

        I don't know the exact reason why it fails. It does not work on my box either.

        You can put the perl code into its own file and call that using

        @
        CMD2 = $$system(perl findRulesMake.pl)
        @

        This works for me.

        http://www.catb.org/~esr/faqs/smart-questions.html

        1 Reply Last reply
        0
        • D Offline
          D Offline
          DannyK
          wrote on last edited by
          #4

          Thanks.
          Using a file is where I started but I still have to know where the file is. My hope was to have a small line in each of my project files that determined the location of the specific file.

          Although I would love to know why Qt3 runs in fine and Qt4 qmake does not.

          I figured out a qmake project file version that seems to work.

          @
          rules_dir=$$IN_PWD
          pwd=$$split(IN_PWD,/)
          for(p,pwd){
          exists($$rules_dir/rules.make):eval(RULES_DIR=$$rules_dir):break()
          else:rules_dir=$$dirname(rules_dir)
          }
          @

          [EDIT: code formatting, please wrap in @-tags, Volker]

          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