On 12/28/2011 05:39 PM, Belcourt, K. Noel wrote:
> Hi Aaron,
>
> On Dec 27, 2011, at 11:04 PM, Aaron Ten Clay wrote:
>
>> -----BEGIN PGP SIGNED MESSAGE-----
>> Hash: SHA1
>>
>> On 12/27/11 16:16, Belcourt, Kenneth wrote:
>>> I'm trying to get CMake to execute this command
>>>
>>> INSTALL(CODE
>>> "EXECUTE_PROCESS (COMMAND cat
>> \"${CMAKE_CURRENT_SOURCE_DIR}/onejar_classpath.txt >>
>> ${CMAKE_INSTALL_PREFIX}/onejar/boot-manifest.mf\")"
>>> )
>>>
>>> but this doesn't work, here's the error I get when I run the install.
>>>
>>> I've checked that both the source and target files exist and are
>> writable. Any ideas on how to get this to work?
>>>
>> It looks as thought you might be missing some escaped double-quotes.
>
> I've tried quite a few quoting permutations, none work.
>
>> INSTALL(CODE
>> "EXECUTE_PROCESS (COMMAND cat
>> \"${CMAKE_CURRENT_SOURCE_DIR}/onejar_classpath.txt\" >>
>> \"${CMAKE_INSTALL_PREFIX}/onejar/boot-manifest.mf\")"
>> )
>
> Unfortunately this doesn't work.
AFAIK, this is because EXECUTE_PROCESS() doesn't fork a shell to run
the COMMANDs, so the redirection operators like ">>" are meaningless.
>> It's also worth noting that this is not a cross-platform command.
>
> Yup, we're a unix only shop.
Then use one of the premier *nix tools:
INSTALL(CODE "EXECUTE_PROCESS(COMMAND sh -c \"cat
\\\"${CMAKE_CURRENT_SOURCE_DIR}/onejar_classpath.txt\\\" >>
\\\"${CMAKE_INSTALL_PREFIX}/onejar/boot-manifest.mf\\\"\")")
Regards,
Michael
>> Maybe
>> look at file(READ ...) followed by file(APPEND ...)?
>
> Looks promising, I'll check this out.
>
> Thanks for the help Aaron.
>
> -- Noel
--
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