David

I think this works. (bloody awful though)

JB


SET (CMD $<TARGET_FILE:H5detect>)

FILE(WRITE ${CMAKE_BINARY_DIR}/H5Tinit.cmake "
    EXECUTE_PROCESS(
      COMMAND \${TRG}
      OUTPUT_VARIABLE H5TINIT_CONTENTS
    )
    FILE(WRITE \${DST} \"\${H5TINIT_CONTENTS}\")
")

ADD_CUSTOM_COMMAND(
    OUTPUT ${CMAKE_BINARY_DIR}/H5Tinit.c
    COMMAND ${CMAKE_COMMAND}
      -DTRG=${CMD}
      -DDST=${CMAKE_BINARY_DIR}/H5Tinit.c
      -P ${CMAKE_BINARY_DIR}/H5Tinit.cmake
    )
ADD_CUSTOM_TARGET(h5tinit DEPENDS ${CMAKE_BINARY_DIR}/H5Tinit.c)




From: [email protected] [mailto:[email protected]] On Behalf Of 
Biddiscombe, John A.
Sent: 05 August 2011 14:34
To: David Cole
Cc: [email protected]
Subject: Re: [CMake] odd cmake/DOS bug/issue with eol

David

>Yes, it's probably an intermediate (make, shell?) "interpreting" the output 
>along the way.
does that mean it's a bug?

>You can try to add "VERBATIM" to the custom command call and see if that helps.
Nope. Same result. I think verbatim just leaves the args untouched rather than 
the output.

>Or, you could write it as a batch/shell/cmake/other script and have the custom 
>command invoke the script, capture the output into a variable and write the 
>file directly, rather than using the shell redirection operator.
Can you point me to an example of this that I might copy?

>Or... maybe H5detect could take a file name as an arg and write the file 
>directly itself rather than pushing it to stdout?
this will be harder to get back into the official release as it will probably 
needs signing off on etc.

ta

JB
_______________________________________________
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