[CMake] add_custom_target: always built during "make" and "make install"

Romain CHANU romainchanu at gmail.com
Mon Nov 2 10:28:08 EST 2009


1. If there is a restriction / condition regarding the "out-of-date"
behavior, it might be good to update the documentation.

2. Yes you are right, I got confused at some point :-\ It is fixed. But
still, it is compiling twice during "make" and "make install" (it should not
compile during the latest command)

3. I am not 100% sure also... Anyone to give us an advice on that matter??

Cheers,

Romain Chanu

2009/11/2 Tyler Roscoe <tyler at cryptio.net>

> On Mon, Nov 02, 2009 at 10:48:49PM +0800, Romain CHANU wrote:
> > # Add a custom target to manage dependencies
> > add_custom_target(cxx_xml_mapping DEPENDS xml_mapping)
> >
> > add_custom_command(
> >   OUTPUT cxx_xml_mapping
> >   COMMAND ${XSD_EXECUTABLE} ARGS ${XSD_ARGS}
> > ${CMAKE_CURRENT_SOURCE_DIR}/*.xsd
> >   DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/*.xsd
> >   COMMENT "Generating C++ / XML mapping files")
>
> Not sure if this is your problem but:
>
> 1. I don't think that verbiage in the docs about custom commands
> *always* being out-of-date applies to makefile generators. I've only
> seen that behavior in Visual Studio.
>
> 2. Your custom_command needs to have an OUTPUT that corresponds to the
> DEPENDS of your custom_target. Here you have two different names,
> xml_mapping and cxx_xml_mapping.
>
> 3. I'm not sure your custom_command can DEPEND on *.xsd. How is CMake
> supposed to know whether *.xsd refers to 4 files or 40 files, and thus
> how can it know when that set of files is up-to-date or not?
>
> hth,
> tyler
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20091102/7a8c83e9/attachment.htm>


More information about the CMake mailing list