October 5, 2011

DannyK DannyK
Lab Rat
2 posts

using the system function in qmake

 

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?

  1. CMD2 = $$system(perl -MCwd -MFile::Basename -MFile::Spec -e '$_=&getcwd();while($_ ne "/"){if( -e File::Spec->catfile($_,"rules.make")){print $_;last;} $_=dirname($_);} ' )
  2. 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]

3 replies

October 5, 2011

Vass Vass
Hobby Entomologist
738 posts

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

 Signature 


Vasiliy

October 5, 2011

Volker Volker
Robot Herder
5428 posts

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

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

This works for me.

October 7, 2011

DannyK DannyK
Lab Rat
2 posts

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.

  1. rules_dir=$$IN_PWD
  2. pwd=$$split(IN_PWD,/)
  3. for(p,pwd){
  4.   exists($$rules_dir/rules.make):eval(RULES_DIR=$$rules_dir):break()
  5.   else:rules_dir=$$dirname(rules_dir)
  6. }

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

 
  ‹‹ import from Xcode add libs      viewing vectors in the debugger? ››

You must log in to post a reply. Not a member yet? Register here!