[cmake-developers] custom_command rebuild output file when depend files change?

Robert Goulet Robert.Goulet at autodesk.com
Mon Jun 1 14:14:13 EDT 2015


Removing the line

set_source_files_properties(${OUTPUT_FILE} PROPERTIES GENERATED 1)

...fixed it.

Indeed the documentation says "Each output file will be marked with the GENERATED source file property automatically". However it does not mention that setting that property ourselves prevents the dependencies from functioning correctly. Perhaps it's a bug, I don't know.

But now it works, thanks for the pointer Brad !


-----Original Message-----
From: Brad King [mailto:brad.king at kitware.com] 
Sent: Monday, June 1, 2015 2:11 PM
To: Robert Goulet
Cc: cmake-developers at cmake.org
Subject: Re: [cmake-developers] custom_command rebuild output file when depend files change?

On 06/01/2015 02:03 PM, Robert Goulet wrote:
> Forgot to mention, we also do this after:
> set_source_files_properties(${OUTPUT_FILE} PROPERTIES GENERATED 1)

That shouldn't be necessary.  add_custom_command does that for you.

> list(APPEND SOURCE_FILES ${OUTPUT_FILE}) [...] 
> add_library(${PROJECT_NAME} STATIC ${SOURCE_FILES})

Please post a complete example.

Thanks,
-Brad



More information about the cmake-developers mailing list