I have the problem that add_custom_command is always out of date and therefore runs on every build. the custom command runs a tool that is a target of the same project to generate a file that is used by another target:
add_executable(GeneratorTool main.cpp)
add_custom_command(
OUTPUT generated.h
COMMAND GeneratorTool
DEPENDS main.cpp
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
COMMENT "** GeneratorTool **"
)
add_library(MyLib STATIC generated.h ...)
In the build output (visual studio 2010) I always see ** GeneratorTool **. I would expect that it does not build again once generated.h exists and is newer than main.cpp. Any ideas?
Thanks, Jochen