View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0008438CMakeCMakepublic2009-01-29 10:402016-06-10 14:30
ReporterHugo Heden 
Assigned ToKitware Robot 
PlatformOSOS Version
Product VersionCMake-2-6 
Target VersionFixed in Version 
Summary0008438: add_dependencies() for "build-in cmake targets"
DescriptionCurrently, add_dependencies can not be used to create a dependency if one of the specified targets is a cmake "build-in" target, like "test", "install" or "all".

I would like to be able to specify such dependencies.

Use-case currently at hand: We have a large test-suite for checking the *installed* software, and would thusly like to be able to write

ADD_DEPENDENCIES( TestAllPackagesWhenInstalled INSTALL )

TagsNo tags attached.
Attached Files

related to 0006348closedKitware Robot custom global targets (targets which when built from the root build all targets with the same name in subdirs) 
related to 0012960closedNils Gladitz CMake should reject targets with reserved names like "test" 
related to 0012961closedKitware Robot CMAKE_INSTALL_BEHAVIOR and allowing users to run INSTALL under Visual Studio by default 
related to 0013170closedNils Gladitz add_executable(test) & ENABLE_TESTING 

Brad King (manager)
2009-01-29 14:35

This has been on my todo list for a long time. See issue 0006348, my comment at time 2008-02-14 17:14.
Hugo Heden (reporter)
2010-11-18 06:48
edited on: 2010-11-18 06:49

Another use-case is this: Somehow invoke a sub-process, "ant clean", whenever the "clean"-target is executed [^]

Hugo Heden (reporter)
2010-11-18 06:51

Brad: I'm not completely sure that issue 0006348 is the same as this one, but I guess I'll take your word for it.
Eric NOULARD (developer)
2011-01-13 07:30

Just to note that the complete need would be
to be able to

1) add dependency TO builtin target like:
   add_dependencies(package MyDoxygenCustomTarget)

   which will enforce the "MyDoxygenCustomTarget" to be called
   whenever the builtin target "package" is built.

2) add dependency FROM builtin target like:
   add_dependencies(TestAllPackagesWhenInstalled install)
   which will enforce the builtin target "install" to
   be built whenever "TestAllPackagesWhenInstalled" is.
Hugo Heden (reporter)
2011-01-13 07:56

Thanks for noting that Eric, I don't think I had thought about that the _two_ directions of dependencies. You're right.
Brad King (manager)
2011-05-17 15:53

Moving to backlog. I think the approach mentioned in 0006348:0010505 will work but I have no time to work on this.
David Cole (manager)
2011-05-25 16:54

Not for 2.8.5 - postponing until a future release
Tomasz Majchrowski (reporter)
2011-08-12 07:51

Is there any chance to fix it for coming 2.8.6 ?
David Cole (manager)
2011-08-12 08:59
edited on: 2011-08-12 09:00

Not really a good chance of fixing this for 2.8.6 unless somebody proposes a reasonable patch that works, has tests associated with it, and does not seem too risky or de-stabilizing.

Brad's note from May 17 still stands: "Moving to backlog. I think the approach mentioned in 0006348:0010505 will work but I have no time to work on this."

It's in the "backlog" and it is assigned to nobody. That typically means it's not being actively pursued by anybody.

Eric NOULARD (developer)
2011-10-24 12:48

Targeting 2.8.7 because it has been raised on the ML request right after 2.8.6
and because I vote for this too :-]
David Genest (reporter)
2011-11-03 12:03

I would like to add a vote to this feature also. We are using cmake in a very Visual Studio Savy workplace. People here do not want to manually add files to the CMakeLists.

For this reason, we have cmake harvest the source tree at generation, and a script to compare the actual source tree files to know if a regeneration is needed. I know it is not the CMake way, but it has worked very well for us.

If we could add a dependency from ZERO_CHECK to our source tree verification command, the integration would be complete. (When the script detects a change, it touches the top-most CMakeLists.txt). Right now, we depend on our top level dependency, and sometimes the re-generation gets caught too late.
Chris Scharver (reporter)
2011-11-23 10:34

I would like this too, as it would allow us to easily build installers through a custom target depending on INSTALL.
David Cole (manager)
2011-12-13 19:21

Unset target version field; too late for a fix to go into 2.8.7; deferred until a future version.
David Cole (manager)
2012-01-07 10:03

Repeating/updating my own note: Not really a good chance of fixing this for 2.8.8 unless somebody proposes a reasonable patch that works, has tests associated with it, and does not seem too risky or de-stabilizing.

For more comments, see:



David Cole (manager)
2012-04-19 08:40

Unsetting target version, removing from roadmap, nobody is working on this.

When somebody begins active development work on this issue, I'll put it back on the roadmap. Until then, it's in the backlog...
franck.bonin (reporter)
2013-02-08 10:19

I would like this.
For me it would enabling signing CPack generated installer with a custom post package target. Let me try this :

   add_custom_target(signpackage package COMMAND signtool.exe ...)
   add_custom_target(signpackage package COMMAND productsign ...)
   add_custom_target(signpackage package COMMAND echo no signing)

add_dependencies(signpackage package)
ycollet (reporter)
2013-06-14 05:40

I just vote for this feature.
Bjoern Thiel (reporter)
2013-11-05 09:48

Me too.
Tomasz Majchrowski (reporter)
2013-11-13 14:48

Jean-Bernard Jansen (reporter)
2014-09-06 15:32

I would definitely like that feature too.
Pascal Bach (reporter)
2014-10-20 05:21

I'm trying to integrate an Ant build with CMake. And it would be nice if I could just add a custom_command that calls ant install and make it a dependency of the built-in install target. So this would be a great help.
Brad King (manager)
2014-10-20 09:35

Re 0008438:0037050: That is the opposite direction of this issue, which is about making a custom target depend on a builtin target. Do run extra steps during installation, use the install(SCRIPT) or install(CODE) command.
Josh Klontz (reporter)
2014-12-03 09:52

Tom Hughes (reporter)
2015-04-07 12:57

(0038820) (reporter)
2015-05-29 11:22

At the very minimum it should be stated in the documentation that this is not possible.

That is: in every single place in the docs were it says "You can add a target here" it should also say "(but remember there are no target names for all, install, test, ...)".

I just wasted an hour of my life trying to find out how to do this and scratching my head about why ALL or CMAKE_PROJECT_NAME do not work.
Benoît Bleuzé (reporter)
2015-09-28 11:12

As everyone else I would like to show my interest for this topic, as I would like to depend on the "package" target.

The ramifications of this particular issue seem to be to extensive for me to work on a first patch for cmake, but is there anything else I can do to push this issue closer to resolution?
Davy Durham (reporter)
2015-10-28 01:30

+1 for me too.

In the mean time, my issue is that I add_subdirectory(.. EXCLUDE_FROM_ALL) on a CMakeLists.txt which defines many targets, but I only want a couple of them built by default.

So my CMakeLists.txt looks like so...
   add_subdirectory(many_targets EXCLUDE_FROM_ALL)

   add_custom_target(build_anyway ALL)

IMO, it would make perfect since to be able to say something like:
   add_subdirectory(many_targets EXCLUDE_FROM_ALL)


It's just a slightly smaller bit of code, but also doesn't have the problem of having to make up a unique name for a faux target and is conceptually more straight-forward.
Christopher Sean Morrison (reporter)
2015-11-24 10:31

Ditto, need this. :)
arufanov (reporter)
2015-12-03 02:14

Also need this for sign dll & msi package based on package built-in target.
Kitware Robot (administrator)
2016-06-10 14:27

Resolving issue as `moved`.

This issue tracker is no longer used. Further discussion of this issue may take place in the current CMake Issues page linked in the banner at the top of this page.

 Issue History
Date Modified Username Field Change
2009-01-29 10:40 Hugo Heden New Issue
2009-01-29 14:27 Bill Hoffman Status new => assigned
2009-01-29 14:27 Bill Hoffman Assigned To => Brad King
2009-01-29 14:35 Brad King Note Added: 0014723
2009-01-29 14:35 Brad King Relationship added related to 0006348
2010-11-18 06:48 Hugo Heden Note Added: 0023373
2010-11-18 06:49 Hugo Heden Note Edited: 0023373
2010-11-18 06:51 Hugo Heden Note Added: 0023374
2011-01-13 07:30 Eric NOULARD Note Added: 0024642
2011-01-13 07:56 Hugo Heden Note Added: 0024643
2011-04-14 14:27 David Cole Target Version => CMake 2.8.5
2011-05-17 15:53 Brad King Note Added: 0026520
2011-05-17 15:53 Brad King Assigned To Brad King =>
2011-05-17 15:53 Brad King Status assigned => backlog
2011-05-25 16:54 David Cole Note Added: 0026589
2011-05-25 16:54 David Cole Target Version CMake 2.8.5 =>
2011-08-12 07:51 Tomasz Majchrowski Note Added: 0027192
2011-08-12 08:59 David Cole Note Added: 0027193
2011-08-12 09:00 David Cole Note Edited: 0027193
2011-10-24 12:48 Eric NOULARD Note Added: 0027638
2011-10-24 12:48 Eric NOULARD Target Version => CMake 2.8.7
2011-11-03 12:03 David Genest Note Added: 0027717
2011-11-23 10:34 Chris Scharver Note Added: 0027852
2011-12-13 19:21 David Cole Note Added: 0027967
2011-12-13 19:21 David Cole Target Version CMake 2.8.7 =>
2012-01-03 16:21 David Cole Target Version => CMake 2.8.8
2012-01-07 10:03 David Cole Note Added: 0028212
2012-02-13 09:48 Brad King Relationship added related to 0012960
2012-02-14 10:40 Brad King Relationship added related to 0012961
2012-04-19 08:40 David Cole Note Added: 0029232
2012-04-19 08:40 David Cole Target Version CMake 2.8.8 =>
2012-04-26 08:15 Brad King Relationship added related to 0013170
2013-02-08 10:19 franck.bonin Note Added: 0032225
2013-06-14 05:40 ycollet Note Added: 0033282
2013-11-05 09:48 Bjoern Thiel Note Added: 0034392
2013-11-13 14:48 Tomasz Majchrowski Note Added: 0034448
2014-09-06 15:32 Jean-Bernard Jansen Note Added: 0036736
2014-10-20 05:21 Pascal Bach Note Added: 0037050
2014-10-20 09:35 Brad King Note Added: 0037055
2014-12-03 09:52 Josh Klontz Note Added: 0037368
2015-04-07 12:57 Tom Hughes Note Added: 0038467
2015-05-29 11:22 Note Added: 0038820
2015-09-28 11:12 Benoît Bleuzé Note Added: 0039488
2015-10-28 01:30 Davy Durham Note Added: 0039691
2015-11-24 10:31 Christopher Sean Morrison Note Added: 0039907
2015-12-03 02:14 arufanov Note Added: 0039940
2016-06-10 14:27 Kitware Robot Note Added: 0041496
2016-06-10 14:27 Kitware Robot Status backlog => resolved
2016-06-10 14:27 Kitware Robot Resolution open => moved
2016-06-10 14:27 Kitware Robot Assigned To => Kitware Robot
2016-06-10 14:30 Kitware Robot Status resolved => closed

Copyright © 2000 - 2018 MantisBT Team