MantisBT - CMake
View Issue Details
0012057CMakeCMakepublic2011-04-07 18:362011-04-08 08:56
Stephen Kelly 
Brad King 
normalminoralways
closedduplicate 
 
CMake 2.8.4 
0012057: add_custom_command can not depend on a custom target
From the docs:

http://www.cmake.org/cmake/help/cmake-2-8-docs.html#command:add_custom_command [^]

 DEPENDS specifies any target (created by an ADD_* command) a target-level dependency is created to make sure the target is built before any target using this custom command.

project(hello)

cmake_minimum_required(VERSION 2.8)
    
add_executable(hello hello.cpp)

add_custom_target(customTarget ALL COMMENT "CUSTOM TARGET")

add_custom_command(OUTPUT customCommandOutput COMMAND sleep 30 DEPENDS customTarget COMMENT "CUSTOM COMMAND")

add_custom_target(outtarget DEPENDS customCommandOutput COMMENT "OUT")

add_dependencies(hello outtarget)
$ make
makeobj[0]: Entering directory `/home/kde-devel/dev/src/playground/cust_command_broken/build'
Scanning dependencies of target customTarget
[ 0%] CUSTOM TARGET
[ 25%] Built target customTarget
Scanning dependencies of target outtarget
make[2]: *** No rule to make target `customTarget', needed by `customCommandOutput'. Stop.
make[1]: *** [CMakeFiles/outtarget.dir/all] Error 2
make: *** [all] Error 2
makeobj[0]: Leaving directory `/home/kde-devel/dev/src/playground/cust_command_broken/build'
No tags attached.
duplicate of 0011332closed Brad King No dependency from ADD_CUSTOM_COMMAND to external project 
Issue History
2011-04-07 18:36Stephen KellyNew Issue
2011-04-07 18:55Rolf Eike BeerNote Added: 0026146
2011-04-08 08:56Brad KingRelationship addedduplicate of 0011332
2011-04-08 08:56Brad KingNote Added: 0026149
2011-04-08 08:56Brad KingStatusnew => closed
2011-04-08 08:56Brad KingAssigned To => Brad King
2011-04-08 08:56Brad KingResolutionopen => duplicate
2011-04-08 08:56Brad KingFixed in Version => CMake 2.8.4

Notes
(0026146)
Rolf Eike Beer   
2011-04-07 18:55   
Have you tried 2.8.4? This should have been fixed there.
(0026149)
Brad King   
2011-04-08 08:56   
This is a duplicate of issue 0011332 which was fixed for 2.8.4.

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=ced1d5ec [^]