[CMake] add_custom_target always runs?
Tyler Roscoe
tyler at cryptio.net
Tue Dec 16 17:09:15 EST 2008
On Tue, Dec 16, 2008 at 09:44:38PM +0100, Eric NOULARD wrote:
> > Ok, so is it simply impossible to do delta builds if my build process
> > needs add_custom_command/add_custom_target invocations? Is there some
> > better way to have CMake create the headers for me? Does this behavior
> > of add_custom_target only occur when I add a new target dependent on
> > ALL?
>
> Why do you add "ALL" in your case?
>
> Won't generateheader be called when needed when you remove the ALL
> argument to add_custom_target?
>
> Note that another way to go is completely remove the add_custom_target
> and add the generated header to the concerned add_executable /
> add_library command.
>
> then you have to:
>
> set_source_files_properties(results/header.h PROPERTIES GENERATED true)
> in order to avoid to make add_library/add_executable shout at you
> about missing files.
>
> Then when the concerned libraries and/or executable are built
> CMake should automatically run your add_custom_command since it
> advertise it has the missing "results/header.h" as output.
I presented a simplified version of my problem. In reality, I have a
cmake project that takes a bunch of headers, mangles them with scripts,
and then collects them in a directory so I can have a single
INCLUDE_DIR.
I would like to handle all these headers by themselves rather than
having DEPENDS references to them all over the source tree. The way I
have it now, BigLibrary1... BigLibraryN INCLUDE() Headers/CMakeLists.txt
so that all the headers can be "built" before trying to build one of the
BigLibraries.
Am I thinking about this the wrong way? I find that the way I think
about build problems is often quite different from how CMake thinks
about those same problems.
Thanks,
tyler
More information about the CMake
mailing list