[CMake] add_custom_command weirdness

Christoph Höger choeger at cs.tu-berlin.de
Wed Apr 7 07:26:28 EDT 2010


Hi all,

here comes the testcase:

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)


Under windows XP cmake 2.8 the first file (test.h) will be always deleted when cmake is invoked, while the other ones still exist.
This does not happen, when add_custom_command has only one output file. Obviously a bug.


More information about the CMake mailing list