+ Reply to Thread
Results 1 to 2 of 2

Thread: qmake - how to extract number from variable

  1. #1
    Join Date
    Nov 2007
    Posts
    12
    Thanks
    2
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default qmake - how to extract number from variable

    Hi All,

    In a pro file:
    ############
    VERSION = 1.8.0

    # This should be extracted from VERSION (but how?)
    VERSION_MAJ = $$find(VERSION, regular expression?)
    message($$VERSION_MAJ)
    ###########

    Require VERSION_MAJ to be 1 via the $$find function.

    What is the form of the regular expression to achieve required result?

    Thanks

    Vanir

  2. #2
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,507 Times in 1,384 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: qmake - how to extract number from variable

    qmake Code:
    1. VERSIONS = $$split(VERSION, ".")
    2. VERSION_MAJ = $$member(VERSIONS, 0)
    3. VERSION_MIN = $$member(VERSIONS, 1)
    4.  
    5. lessThan(VERSION_MAJ, 1) | lessThan(VERSION_MIN, 8) {
    6. error(Project requires version 1.8 or newer but $$VERSION was detected.)
    7. }
    To copy to clipboard, switch view to plain text mode 
    J-P Nurmi

  3. The following user says thank you to jpn for this useful post:

    Vanir (15th January 2009)

+ Reply to Thread

Similar Threads

  1. nmake error during .pro compiling
    By mattia in forum Installation and Deployment
    Replies: 5
    Last Post: 18th June 2008, 11:15
  2. qmake + Incremented Builder Version Number
    By NoRulez in forum Qt Programming
    Replies: 1
    Last Post: 9th May 2008, 16:15
  3. KDE/QWT doubt on debian sarge
    By hildebrand in forum KDE Forum
    Replies: 13
    Last Post: 25th April 2007, 07:13
  4. Compiling with Qmake/Make
    By VireX in forum Newbie
    Replies: 25
    Last Post: 22nd February 2007, 06:57

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts