Yay, that is almost what I want. Except that I'd like the launch target to behave exactly like the
parent target: When I select the project in Visual Studio, I'd like to press F7 to build it and F5
to run it (with the debugger attached). When using add_custom_target(), the exe is started at build
time. I've tried add_executable(.. IMPORTED), but it doesn't create a VS project.
Regards,
Andreas
On 08.02.2013 15:37, [email protected] wrote:
You need an intermediary layer that depends on parent and child and
wraps execution of parent.
Something like this (untested):
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_custom_target(launch "${CMAKE_CURRENT_BINARY_DIR}/parent.exe")
add_dependencies(launch parent child)
Cya, Ed
On 02/08/2013 03:16 PM, Andreas Haferburg wrote:
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
--
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