[CMake] Dependency for launching an application

Andreas Haferburg ahaferburg at scopis.com
Fri Feb 8 09:16:20 EST 2013


Sure. Example:

add_library(common MyFancyString.cpp)

add_executable(parent parent_main.cpp)
target_link_libraries(parent common.lib)

add_executable(child child_main.cpp)
target_link_libraries(child common.lib)
add_dependencies(parent child)

Now I make a change to MyFancyString.cpp, select the parent project, and hit F5. Both executables 
use MyFancyString, so both need to be re-built.

What happens is that common is built, then child, then parent, then parent is executed.
What I'd like to happen is that common is built, then child+parent are being built concurrently, and 
as soon as both are done, parent is executed.

I hope it's clearer now.

Regards,
Andreas



On 08.02.2013 12:51, Nick Overdijk wrote:
> Well cmake will take care of that if you target_link_library(common), right?
>
> On 2013-08-02, at 12:50:13 , Andreas Haferburg wrote:
>
>> Right, sorry. I should have mentioned that they both depend on some library common.lib. When that library has to be rebuilt, both exes need to be rebuilt, too.
>>
>> Andreas
>>
>>
>> On 08.02.2013 12:21, Nick Overdijk wrote:
>>> Can't you only launch parent.exe in VS and remove the dependency?
>>>
>>> On 2013-08-02, at 12:19:56 , Andreas Haferburg wrote:
>>>
>>>> In our build, we have two executables, parent.exe launches child.exe as a child process. ATM the build is set up with add_dependencies(parent child). So when using F5 in Visual Studio, child.exe is built first, then parent.exe, then parent.exe is launched. Is it possible to set this up such that child.exe and parent.exe are built in parallel before launching parent?
>>>>
>>>> Regards
>>>> Andreas
>>>> --
>>>>
>>>> Powered by www.kitware.com
>>>>
>>>> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>>>>
>>>> Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ
>>>>
>>>> Follow this link to subscribe/unsubscribe:
>>>> http://www.cmake.org/mailman/listinfo/cmake
>>>
>>
>>
>> --
>> Scopis GmbH
>> Blücherstr. 22
>> 10961 Berlin
>> Germany
>>
>> E-Mail: ahaferburg at scopis.com
>> Tel.: +49 (30) 201 69 38 0
>> Fax.: +49 (30) 201 69 38 20
>> Internet: www.scopis.com
>>
>> HRB 128315 Berlin Charlottenburg
>> USt-IdNr.: DE272721463
>> Steuernummer: 29/014/02034
>> Geschäftsführer:  Bartosz Kosmecki
>>
>> Diese E-mail, einschließlich der Anhänge, ist ausschließlich für den oben genannten Adressaten bestimmt und beinhaltet vertrauliche und/oder gesetzlich geschützte Informationen. Jedem anderen Empfänger ist die Vervielfältigung, Weitergabe oder Veröffentlichung untersagt. Falls Sie diese Mitteilung irrtümlicherweise erhalten haben, bitten wir um sofortige Information an den Absender und Vernichtung der E-mail.
>>
>> This e-mail, including the attachments, is for the exclusive use of the above-named addresses and contains confidential information and/or information protected by law. Any other recipient is prohibited from duplicating, passing on to third parties, or publishing this information. If by error you are the recipient of this communication please inform the sender immediately and permanently delete this e-mail.
>


-- 
Scopis GmbH
Blücherstr. 22
10961 Berlin
Germany

E-Mail: ahaferburg at scopis.com
Tel.: +49 (30) 201 69 38 0
Fax.: +49 (30) 201 69 38 20
Internet: www.scopis.com

HRB 128315 Berlin Charlottenburg
USt-IdNr.: DE272721463
Steuernummer: 29/014/02034
Geschäftsführer:  Bartosz Kosmecki

Diese E-mail, einschließlich der Anhänge, ist ausschließlich für den oben genannten Adressaten 
bestimmt und beinhaltet vertrauliche und/oder gesetzlich geschützte Informationen. Jedem anderen 
Empfänger ist die Vervielfältigung, Weitergabe oder Veröffentlichung untersagt. Falls Sie diese 
Mitteilung irrtümlicherweise erhalten haben, bitten wir um sofortige Information an den Absender und 
Vernichtung der E-mail.

This e-mail, including the attachments, is for the exclusive use of the above-named addresses and 
contains confidential information and/or information protected by law. Any other recipient is 
prohibited from duplicating, passing on to third parties, or publishing this information. If by 
error you are the recipient of this communication please inform the sender immediately and 
permanently delete this e-mail.


More information about the CMake mailing list