How to add dependency in cmake targets?

Here the CMake FAQ . It clearly states that add_custom_command/add_custom_target, which defines custom target has DEPENDS parameter.

Up vote 1 down vote favorite share g+ share fb share tw.

I have defined a custom target in cmake. I now want to ensure that this target is only build when the cmake target test was executed. How can I achieve this.

Lets say that I have a target make coverage which should depend on the target make test to be called before, or call make test before executing. How can I define this behavior in cmake? Here my code that did not work as expected.

I want to achive that make coverage depend that make test has to be called before. ADD_CUSTOM_TARGET( coverage COMMAND /bin/bash ${LIBPIPE_BINARY_DIR}/cmake/scripts/coverage. Sh DEPENDS test ) cmake link|improve this question edited Nov 10 '11 at 2:06 asked Nov 10 '11 at 0:24tune2fs1,647112 100% accept rate.

– arrowdodger Nov 10 '11 at 5:42 test is a custom_target – tune2fs Nov 10 '11 at 13:29 Strange. Custom target is always out of date, so if you run make coverage it should run test first. – arrowdodger Nov 10 '11 at 13:49.

Here the CMake FAQ. It clearly states that add_custom_command/add_custom_target, which defines custom target has DEPENDS parameter.

I saw this but unfortunately it did not work for me. I have added some code I tried above. – tune2fs Nov 10 '11 at 2:07 Here the similar topic which could be useful for you stackoverflow.com/questions/733475/… – Sergey Nov 10 '11 at 3:17.

You cannot add a "DEPENDS test" clause. The pre-defined/built-in targets in CMake (all, install, package, test, clean) are not available as actual targets in a CMakeLists. Txt file.

So you cannot express a dependency on a built-in target. There is an outstanding feature request in the CMake bug tracker for this feature, but it is not yet implemented. See public.kitware.com/Bug/view.php?id=8438 However, you could change your command for your custom target, though, such that it calls "make test" first, and then runs your coverage command.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions