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

Eric Noulard eric.noulard at gmail.com
Fri Feb 17 07:47:43 EST 2012


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/17f04c7c/attachment.htm>


More information about the CMake mailing list