Yes.

Put it in a *.cmake script file, and then call:

  add_custom_command(OUTPUT ...
    COMMAND ${CMAKE_COMMAND} -P ${dir}/filewrite.cmake
    DEPENDS ${dir}/filewrite.cmake ${other_files_too_maybe}
  )

You cannot call it directly from custom command, because it needs a
CMake process around it. If you want to call CMake at build time to
run a -P script, it's quite reasonable to do so.


HTH,
David


On Fri, Dec 23, 2011 at 9:22 AM,  <[email protected]> wrote:
> Hi,
>
> is it possible to use file(write...) for a add_custom_command or 
> add_custom_target?
>
> Thanks in advance
>
> Best Regards
> NuRulez
>
> P.S.: Merry Christmas and a happy new year
> --
>
> 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
--

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

Reply via email to