Results 1 to 5 of 5

Thread: how to avoid creating Makefile for an subdir

  1. #1
    Join Date
    Jun 2009
    Posts
    74
    Thanks
    23
    Thanked 2 Times in 2 Posts

    Default how to avoid creating Makefile for an subdir

    Hi ,

    Before compile my program ,I need to compile a 3rd party library,but it is not writen in QT ,it has a Makefile to build itself . so if I write a pro file like this:

    TEMPLATE = subdirs
    SUBDIRS += image myapp

    image directory is the 3rd party library,

    then qmake,make
    it always report "Cannot find file: image.pro"
    if I write a pro file inside image, it will create a Makefile which will overwrite the original Makefile.

    any suggestions?

    Thanks in advance

  2. #2
    Join Date
    Jan 2006
    Location
    Belgium
    Posts
    1,938
    Thanked 268 Times in 268 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Wiki edits
    20

    Default Re: how to avoid creating Makefile for an subdir

    First, you should never use a Makefile generated by someone else.
    It's a list of build instructions specific for one computer or even one situation.

    You should always generate a Makefile yourself.
    You can do that by either writing a .pro file and run qmake, or a configure file and run .configure, or a cmakelists file and run cmake, ...

    QMake lets you run commands like configure or cmake and than build the code.

  3. #3
    Join Date
    Jun 2009
    Posts
    74
    Thanks
    23
    Thanked 2 Times in 2 Posts

    Default Re: how to avoid creating Makefile for an subdir

    Hi tbscope,

    Thank you very much for your reply.

    the INSTALL file inside the 3rd library ,has following instructions,

    #######################
    mkdir build
    cd build
    cmake -DCMAKE_INSTALL_PREFIX=_preferred_path_ ..
    make
    #######################

    I want run the commands automatically before build my own QT app,how can I do that?



    Thanks


    Added after 5 minutes:


    my directory structure is:

    myapp
    |
    |__dir image(3rd library)
    |__dir mylib1(depends on image)
    |__dir mylib2
    |__myapp.pro


    myapp.pro
    ######################
    TEMPLATE = subdirs
    SUBDIRS += image mylib1 mylib2

    Now I am wondering how to execute the commands metioned above if I use qmake and make

    Thanks
    Last edited by hashb; 12th November 2010 at 07:09.

  4. #4
    Join Date
    Jan 2006
    Location
    Belgium
    Posts
    1,938
    Thanked 268 Times in 268 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Wiki edits
    20

    Default Re: how to avoid creating Makefile for an subdir

    You could also write a small batch script.

    But, if you want only .pro files, see this:
    http://doc.qt.nokia.com/4.7/qmake-fu...system-command.

  5. The following user says thank you to tbscope for this useful post:

    hashb (12th November 2010)

  6. #5
    Join Date
    Jun 2009
    Posts
    74
    Thanks
    23
    Thanked 2 Times in 2 Posts

    Default Re: how to avoid creating Makefile for an subdir

    Great, it works!

    myapp.pro
    ######################
    system( cd image;./build.sh; )
    TEMPLATE = subdirs
    SUBDIRS += mylib1 mylib2

    image/build.sh
    ###############
    rm -rf build
    mkdir build
    cd build
    cmake -DCMAKE_INSTALL_PREFIX=_preferred_path_ ..
    make


    Thanks a lot ,tbscope!
    Last edited by hashb; 12th November 2010 at 07:39.

Similar Threads

  1. Replies: 0
    Last Post: 12th October 2010, 04:14
  2. SUBDIR qmake structure
    By mrandreas in forum Newbie
    Replies: 1
    Last Post: 28th September 2010, 14:42
  3. Qt plugin for Eclipse not creating Makefile
    By di_zou in forum Qt Tools
    Replies: 2
    Last Post: 15th October 2009, 15:36
  4. .pro settings for obj subdir
    By bajarangi in forum Newbie
    Replies: 2
    Last Post: 17th April 2009, 14:31
  5. Avoid full recompilation
    By ^NyAw^ in forum General Programming
    Replies: 15
    Last Post: 6th October 2008, 11:31

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.