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?

    @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]



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



  • 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.



  • 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]


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.