Results 1 to 3 of 3

Thread: QMake: using unix backquote commands

  1. #1
    Join Date
    Mar 2011
    Posts
    22
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default QMake: using unix backquote commands

    Hi.
    I' m tring to include an external library to a .pro file.

    To include this library when I compile in manual mode, I use the command

    Qt Code:
    1. c++ -o test test.cpp `/mydir/libmesh-config --cxxflags --include --ldflags`
    To copy to clipboard, switch view to plain text mode 

    I use backquotes to have libraries path and so on. for example if I write
    Qt Code:
    1. /mydir/libmesh-config --include
    To copy to clipboard, switch view to plain text mode 

    I obtain the list of includes in the form

    Qt Code:
    1. -I/mydir/libmesh/include/base -I/mydir/libmesh/include/enums -I/mydir/libmesh/include/error_estimation -I/mydir/libmesh/include/fe -I/mydir/libmesh/include/geom -I/mydir/libmesh/include/mesh -I/mydir/libmesh/include/numerics -I/mydir/libmesh/include/parallel (and so on)
    To copy to clipboard, switch view to plain text mode 

    So I'd like to use this command in the .pro file instead of declaring every include path. The same for the --ldflags flag option that gives to me paths to libraries.

    I've tried to write in the .pro file the following line, for example:

    Qt Code:
    1. unix {
    2. INCLUDEPATH += `/mydir/libmesh-config --include`
    3. }
    To copy to clipboard, switch view to plain text mode 

    but it does not work (I get a "argument:: No such file or directory" error in qtcreator).

    I'd like to know if it's possible to use this command to include libraries, instead of doing it by hand.

    Thanks in advance.

  2. #2
    Join Date
    Jan 2009
    Location
    Germany
    Posts
    131
    Thanks
    11
    Thanked 16 Times in 16 Posts
    Qt products
    Qt3 Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: QMake: using unix backquote commands


  3. #3
    Join Date
    Mar 2011
    Posts
    22
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QMake: using unix backquote commands

    Thanks. I'm trying to set the INCLUDEPATH variable, using this code

    Qt Code:
    1. unix {
    2. TMPPATHS = $$system(/mydir/bin/libmesh-config --include)
    3. LIBMESHINCLUDEPATHS = $$replace(TMPPATHS, "-I", " ")
    4. message(paths $$LIBMESHINCLUDEPATHS)
    5. for(LIBMESHPATH, LIBMESHINCLUDEPATHS)
    6. {
    7. INCLUDEPATH += $$quote($${LIBMESHPATH})
    8. message(Adding include path $${LIBMESHPATH})
    9. }
    10. }
    To copy to clipboard, switch view to plain text mode 
    At first, i set in TMPPATHS the list of directories: then, inn LIBMESHINCLUDEPATHS I erase the "-I" at the beginning of every path (and I print this variable to verify that's ok). Then, I use the for cycle to add every path to the INCLUDEPATH variable.

    But I've a problem in the for cycle. Infact, the message inside the loop is printed only once, and with an empty string in place of LIBMESHPATH. It seems that the cycle fails to initialize this variable, and after the cycle INCLUDEPATH remains empty.

    How can I add paths in the variable to the INCLUDEPATH variable?


    Added after 30 minutes:


    Ok I've solved. I used the following code:

    Qt Code:
    1. ## Adding include paths ##
    2. unix {
    3. TMPPATHS = $$system(/mydir/bin/libmesh-config --include)
    4. INCLUDEPATH += $$replace(TMPPATHS, "-I", "")
    5. }
    To copy to clipboard, switch view to plain text mode 

    Thanks to everyone
    Last edited by jepessen; 6th May 2011 at 11:32.

Similar Threads

  1. Where is the command line for qmake commands?
    By Rakula in forum Installation and Deployment
    Replies: 1
    Last Post: 21st October 2010, 10:53
  2. Executing AT commands
    By jay in forum Qt Programming
    Replies: 4
    Last Post: 8th December 2009, 09:49
  3. qmake DESTDIR permissions behavior (Unix)
    By wdezell in forum Qt Tools
    Replies: 3
    Last Post: 9th March 2009, 14:59
  4. Replies: 3
    Last Post: 8th July 2008, 19:37
  5. Mac Commands
    By shyam prasad in forum Qt Programming
    Replies: 1
    Last Post: 9th January 2007, 15:30

Tags for this Thread

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.