[CMake] cmake (no longer?) complains about missing files

Brad King brad.king at kitware.com
Tue May 27 10:21:42 EDT 2008


Christian Ehrlicher wrote:
> I don't know if it's the intended behaviour or not:
> 
> 
> I create a file on build time with add_custom_command.
> ADD_CUSTOM_COMMAND(OUTPUT ${CMAKE_BINARY_DIR}/my_source.cpp
> 		   COMMAND makeMySource ARGS ${CMAKE_BINARY_DIR}/my_source.cpp 
> )
> 
> and add it to an executable:
> 
> add_executable(myExecutable ${CMAKE_BINARY_DIR}/my_source.cpp)
> 
> 
> cmake does not complain when the file does not exist. For instance when I forgot the add_custom_command() or misspelled the filename. Instead I get an error from make.
> I know there was a change from 2.6.0rc9 to 2.6.0final which fixed an error when a file was created on build-time but the add_custom_command() wasn't already defined.

This was part of that change.  We decided that if the user provides a
full path then we should just trust them that the file will be there in
time for the build.  It is possible that the file is produced as a
side-effect of some other step in a way that CMake does not know.

-Brad


More information about the CMake mailing list