[CMake] Problem with ADD_CUSTOM_COMMAND & ARGS

Eric Tellefsen eric.tellefsen at db.com
Thu Sep 17 08:24:28 EDT 2009


Tyler,

Thank you for the tips on VERBATIM & make VERBOSE=1.  I added VERBOSE to 
my add_custom_command, but it seems that it fixed one problem and caused 
another.

On the plus side, the passed arg "#../../XML/Types/##" is now properly 
quoted.  On the minus side, the xsd command invocation fails outright, 
because for some reason the directory name being passed in for the 
location of the .xsd files ( ${TYPE_XSD_DIR} ) IS being quoted. Previously 
this was not the case (regarding this directory

Any suggestions?

Eric

cmake-bounces at cmake.org wrote on 09/16/2009 04:51:17 PM:

> On Wed, Sep 16, 2009 at 04:27:48PM -0400, Eric Tellefsen wrote:
> > Solaris make 
> 
> My condolences :p.
> 
> > My problem has to do with the ARGS section of the custom command. 
> > Specifically the 'legacy' Makefile uses an argument  --include-regex 
> > "#../../XML/Types/##"  in order to remove this prefix from the 
generated 
> > HXX files, where applicable.
> >
> > ----------- Code which invokes macro
> > SET( STUBDIR ${CMAKE_BINARY_DIR}/Stubs )
> > SET( TYPE_XSD_DIR ${CMAKE_CURRENT_SOURCE_DIR} )
> > SET( TYPE_REGEX_FLAG "#../../XML/Types/##" )
> > 
> > XSDGenCXXSources( TypesOutputFiles
> >                     "${TYPE_REGEX_FLAG}"
> >                     "${TYPE_XSD_DIR}"
> >                     "${STUBDIR}"
> >                     "${CMAKE_CURRENT_SOURCE_DIR}"
> >                     )
> > 
> > ----------- Macro -----------------------------
> > macro ( XSDGenCXXSources OUTPUT_FILES REGEX XSD_DIR OUTPUT_DIR 
Working_Dir 
> > )
> > 
> >     SET( XSD_EXE $ENV{CODE_SYNTHESIS_HOME}/bin/xsd )
> > 
> >     ADD_CUSTOM_COMMAND(
> >             OUTPUT  ${${OUTPUT_FILES}}
> >             COMMAND mkdir
> >             ARGS    -p ${OUTPUT_DIR}
> >             COMMAND ${XSD_EXE}
> >           ARGS    cxx-tree --generate-serialization --output-dir 
> > ${OUTPUT_DIR} --include-regex " ${REGEX} " ${XSD_DIR}/*.xsd
> >             COMMENT "Generating CXX files from ${XSD_DIR} and placing 
them 
> > in ${OUTPUT_DIR}"
> >             WORKING DIRECTORY ${Working_Dir}
> >             )
> > endmacro ( XSDGenCXXSources )
> 
> Usually, problems like this are caused by improper quoting. First, try
> the VERBATIM flag to add_custom_command.
> 
> You can inspect the command line CMake generates for your custom command
> by doing make VERBOSE=1. Hopefully this will give you a clue as to what
> is getting mangled.
> 
> Finally, arguments to macros occasionally do funny things since they
> aren't "real" variables, but that's probably not the problem here.
> 
> tyler
> _______________________________________________
> Powered by www.kitware.com
> 
> Visit other Kitware open-source projects at http://www.kitware.
> com/opensource/opensource.html
> 
> Please keep messages on-topic and check the CMake FAQ at: http:
> //www.cmake.org/Wiki/CMake_FAQ
> 
> Follow this link to subscribe/unsubscribe:
> http://www.cmake.org/mailman/listinfo/cmake


---
This communication may contain confidential and/or privileged information.
If you are not the intended recipient (or have received this communication
in error) please notify the sender immediately and destroy this
communication. Any unauthorized copying, disclosure or distribution of the
material in this communication is strictly forbidden.

Deutsche Bank does not render legal or tax advice, and the information
contained in this communication should not be regarded as such.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20090917/3f315bad/attachment.htm>


More information about the CMake mailing list