[Interest] Qmake: execute two different link steps?

André Hartmann andre.hartmann at iseg-hv.de
Fri Dec 4 14:09:57 CET 2015


Wow. With full example :)

Thanks a lot Elvis, this works indeed fine.

I've also added the following common lines to myProg-sources.pri:

QT += core network
QT -= gui

CONFIG += console
CONFIG -= app_bundle

TEMPLATE = app

List of sources goes here...

The both .pro files now simply contain the TARGET and the link lines,
which is very nice.

Thanks again and best regards,
André


Am 04.12.2015 um 13:28 schrieb Elvis Stansvik:
> 2015-12-04 7:12 GMT+01:00 André Hartmann <andre.hartmann at iseg-hv.de>:
>> Hi Elvis and Konstantin,
>>
>> thanks for your suggestions.
>>
>> I think I will take the SUBDIRS way.
>
> If you want to avoid having to repeat the SOURCES, you can always have
> a myProg-sources.pri that both your myProg.pro and myProg-test
> includes.
>
> Attaching an example with four subdirs (myProg, myProg-test, libXXX
> and libXXXtest) of how you could set it up.
>
> Good luck,
> Elvis
>
>>
>> Best regards,
>> André
>>
>>
>> Am 03.12.2015 um 13:04 schrieb Elvis Stansvik:
>>>
>>> 2015-12-03 13:02 GMT+01:00 Konstantin Tokarev <annulen at yandex.ru>:
>>>>
>>>>
>>>>
>>>> 03.12.2015, 15:00, "Elvis Stansvik" <elvstone at gmail.com>:
>>>>>
>>>>> Hi André,
>>>>>
>>>>> 2015-12-03 10:51 GMT+01:00 André Hartmann <andre.hartmann at iseg-hv.de>:
>>>>>>
>>>>>>    Hello,
>>>>>>
>>>>>>    I have a Qmake based project that is developed in Qt Creator
>>>>>> (currently
>>>>>>    compiled with Linux/gcc and Windows/MinGW).
>>>>>>
>>>>>>    Depending on a configuration variable the PRO file my program links
>>>>>> to one
>>>>>>    of two librarys:
>>>>>>
>>>>>>    TARGET = myProg
>>>>>>
>>>>>>    CONFIG += TESTLIB
>>>>>>
>>>>>>    CONFIG(TESTLIB): LIBS += libXXXtest
>>>>>>    else: LIBS += libXXX
>>>>>>
>>>>>>    For now, I have to change the config variable each time.
>>>>>>
>>>>>>    Is there an easy way to have a second target that is automatically
>>>>>> linked to
>>>>>>    the correct version? The object files are all the same,
>>>>>>    just the link step needs to be executed again. After that, I'd like
>>>>>> have two
>>>>>>    executeables, e.g.:
>>>>>>
>>>>>>    myProg-test -> linked to libXXXtest
>>>>>>    myProg -> linked to libXXX
>>>>>>
>>>>>>    Is this possible?
>>>>>
>>>>>
>>>>> I think with QMake this is not possible without converting your
>>>>> project to a subdirs project (TEMPLATE = subdirs), with separate
>>>>> sub-directories for the executables you wish to build (TEMPLATE =
>>>>> app). Or switch to QBS or CMake.
>>>>>
>>>>> Happy to be proven wrong though :)
>>>>
>>>>
>>>> You can create custom target and do one of link steps manually
>>>
>>>
>>> Ah yes, that is of course a possibility.
>>>
>>> Elvis
>>>
>>>>
>>>> --
>>>> Regards,
>>>> Konstantin
>>>
>>> _______________________________________________
>>> Interest mailing list
>>> Interest at qt-project.org
>>> http://lists.qt-project.org/mailman/listinfo/interest
>>>
>>
>>


-- 
Best regards / Mit freundlichen Grüßen
André Hartmann, Dipl.-Ing. (FH)
Software Project Manager

iseg Spezialelektronik GmbH         |  phone: ++49 (0)351 26996-43
Bautzner Landstr. 23                |  fax:   ++49 (0)351 26996-21
D-01454 Radeberg / Rossendorf       |  web:   www.iseg-hv.com

Geschäftsführer / Managing director: Dr. F. Gleisberg, Dr. J. Pöthig
Amtsgericht / Lower district court: Dresden HRB 16250
Ust.-Id.-Nr. / VAT-ID: DE812508942

Diese E-Mail enthält vertrauliche und/oder rechtlich geschützte
Informationen. Wenn Sie nicht der richtige Adressat sind oder
diese E-Mail irrtümlich erhalten haben, informieren Sie bitte
sofort den Absender und vernichten Sie diese Mail.
Das unerlaubte Kopieren sowie die unbefugte Weitergabe dieser
Mail ist nicht gestattet.

This e-mail may contain confidential and/or privileged information.
If you are not the intended recipient (or have received this e-mail
in error) please notify the sender immediately and delete this e-mail.
Any unauthorized copying, disclosure or distribution of the material
in this e-mail is strictly forbidden.



More information about the Interest mailing list