MantisBT - CMake
View Issue Details
0010515CMakeCMakepublic2010-04-07 07:332016-06-10 14:31
Christoph Höger 
Brad King 
normalminoralways
closedmoved 
CMake-2-8 
 
0010515: cmake deletes output files from add_custom_command under XP
Hi,

I could only reproduces this under XP (I have only cmake 2.6 under fedora here), so this may be a single platform issue.

When using a setup like:

project(cmakeBug)

set(src ${PROJECT_SOURCE_DIR}/src)
set(inc ${PROJECT_SOURCE_DIR}/inc)

add_custom_command(OUTPUT ${inc}/test.h ${inc}/test2.h ${src}/test.c
        COMMAND echo "//foo" > ${inc}/test.h
        COMMAND echo "//foo" > ${inc}/test2.h
        COMMAND echo "//bar" > ${src}/test.c
)

add_executable(test ${src}/main.c ${src}/test.c)


The next call to cmake will remove the first output file (test.h in that case).
Note that this only happens for multiple output files.
No tags attached.
Issue History
2010-04-07 07:33Christoph HögerNew Issue
2010-04-07 11:23Bill HoffmanStatusnew => assigned
2010-04-07 11:23Bill HoffmanAssigned To => Brad King
2010-04-07 12:03Brad KingNote Added: 0020092
2010-04-07 12:07Christoph HögerNote Added: 0020093
2010-04-07 12:10Brad KingNote Added: 0020094
2010-04-07 12:11Brad KingNote Added: 0020095
2012-08-13 10:37Brad KingStatusassigned => backlog
2012-08-13 10:37Brad KingNote Added: 0030530
2016-06-10 14:27Kitware RobotNote Added: 0041679
2016-06-10 14:27Kitware RobotStatusbacklog => resolved
2016-06-10 14:27Kitware RobotResolutionopen => moved
2016-06-10 14:31Kitware RobotStatusresolved => closed

Notes
(0020092)
Brad King   
2010-04-07 12:03   
This is intentional. If any output file does not exist we purposely delete the "primary" output file to ensure that the rule re-runs on the next build.
(0020093)
Christoph Höger   
2010-04-07 12:07   
Would be fine, if this would not happen when all output files do exist and are up-to-date ;)
(0020094)
Brad King   
2010-04-07 12:10   
What happens if you add ${inc}/test.h to the executable sources?

add_executable(test ${src}/main.c ${src}/test.c ${inc}/test.h)
(0020095)
Brad King   
2010-04-07 12:11   
What generator / toolchain are you using?
(0030530)
Brad King   
2012-08-13 10:37   
Sending issues I'm not actively working on to the backlog to await someone with time for them.

If an issue you care about is sent to the backlog when you feel it should have been addressed in a different manner, please bring it up on the CMake mailing list for discussion. Sign up for the mailing list here, if you're not already on it:

 http://www.cmake.org/mailman/listinfo/cmake [^]

It's easy to re-activate a bug here if you can find a CMake developer or contributor who has the bandwidth to take it on.
(0041679)
Kitware Robot   
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.