[CMake] Problem when globbing files and using that OUTPUT variable between ADD_CUSTOM_COMMAND commands

norulez at me.com norulez at me.com
Fri Feb 17 08:05:38 EST 2012


Is there no way to depend on an other custom command without using extra files?

It would be nice if i can pass OUTPUT and TARGET to ADD_CUSTOM_COMMAND.

So i here is my problem in a more detail:
I want to get a list of files from ${CMAKE_RUNTIME_OUTPUT_DIR}/${PROJECT_NAME}.app where all files beginning with ${PROJECT_NAME} would be excluded.
After that I want to iterate over that list (foreach) and run ADD_CUSTOM_COMMAND for each file.

I see here no need for any extra files.

Thanks in advance

Best Regards
NoRulez

Am 17.02.2012 um 13:47 schrieb Eric Noulard <eric.noulard at gmail.com>:

> 
> 
> 2012/2/17 NoRulez <norulez at me.com>:
> > Hi,
> >
> > i have several ADD_CUSTOM_COMMAND commands with a specified target (let's
> > say TARGET1).
> > Between those commands I need to collect files and want to use those
> > collected files in the next ADD_CUSTOM_COMMAND.
> > How can i do that, because the following doesn't work as expected.
> >
> > ADD_CUSTOM_COMMAND(TARGET TARGET1
> >                    COMMAND SAMPLE_COMMAND ARGS ARGUMENTS
> >                    WORKING_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}
> >                    COMMENT "Doing some stuff"
> >                    VERBATIM)
> 
> may be you could do:
> 
> ADD_CUSTOM_COMMAND(TARGET TARGET1
>                    COMMAND SAMPLE_COMMAND ARGS ARGUMENTS
>                    COMMAND ${CMAKE_COMMAND} -DOutFile=fl.cmake -P collectFiles.cmake
>                    COMMAND ${CMAKE_COMMAND} -DInFile=fl.cmake -P doPostProcessing.cmake
>                    WORKING_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}
>                    COMMENT "Doing some stuff"
>                    VERBATIM)
> 
> the "collectFiles" step will do whatever you want and create the fl.cmake file
> which will be loaded by the second "doPostProcessing" in order to get 
> access to list of file in a pre-defined CMake var.
> 
> You can split this in separate add_custom_command but I don't see the need
> in your example.
> 
> 
> > # HERE I NEED A CUSTOM COMMAND where the CUSTOM_FILES variable can be used
> > in the next ADD_CUSTOM_COMMAND
> > ADD_CUSTOM_COMMAND(OUTPUT CUSTOM_FILES
> >                    COMMAND /usr/bin/find ARGS ${CUSTOM_PATH} -type f
> >                    COMMENT "Find files"
> >                    VERBATIM)
> >
> > ADD_CUSTOM_COMMAND(TARGET TARGET1
> >                    COMMAND SAMPLE_COMMAND ARGS ${CUSTOM_FILES}
> >                    WORKING_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}
> >                    COMMENT "Doing some stuff"
> >                    VERBATIM)
> >
> > ADD_CUSTOM_COMMAND(TARGET TARGET1
> >                    COMMAND SAMPLE_COMMAND ARGS ARGUMENTS
> >                    WORKING_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}
> >                    COMMENT "Doing some stuff"
> >                    VERBATIM)
> >
> > Thanks in advance
> >
> > Best Regards
> > NoRuleu
> >
> > --
> >
> > 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
> 
> 
> 
> -- 
> Erk
> Membre de l'April - « promouvoir et défendre le logiciel libre » - http://www.april.org
> 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20120217/33642a87/attachment.htm>


More information about the CMake mailing list