[CMake] Non compiled sources in add_executable

James Bigler jamesbigler at gmail.com
Thu Oct 16 15:58:38 EDT 2008


So I have a command:

add_custom_command(
  OUTPUT myfile.blah
  MAIN DEPENDENCY myfile.orig
  COMMAND ...
  )

Then I add the file to a target:

add_executable(myexec myexec.c myfile.blah)

If myfile.blah disappears and I build myexec via VS, it remakes
myfile.blah, but if the custom command to create myfile.blah fails and
myexec compiles, then myfile.blah's command won't be run again.

Do I need to create a custom target for myfile.blah and then use
add_dependencies?  I was hoping that by adding myfile.blah to the
myexec target that if the myfile.blah command failed it wouldn't
continue to build myexec.

Thanks,
James


More information about the CMake mailing list