Re: [CMake] [EXTERNAL] Re: execute_process appending redirected output

2011-12-30 Thread Michael Hertling
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


Re: [CMake] [EXTERNAL] Re: execute_process appending redirected output

2011-12-30 Thread Belcourt, K. Noel


On Dec 30, 2011, at 8:05 PM, Michael Hertling wrote:


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))


Eek, that's a lot of quoting.  I found a workaround but thanks for  
this, I may use it if opportunity arises in the future.  Perhaps this:



AFAIK, this is because EXECUTE_PROCESS() doesn't fork a shell to run
the COMMANDs, so the redirection operators like  are meaningless.


could be entered into the documentation somewhere as this is important  
to know.  Thanks for the help Michael.


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


Re: [CMake] [EXTERNAL] Re: execute_process appending redirected output

2011-12-28 Thread Belcourt, K. Noel

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.


It's also worth noting that this is not a cross-platform command.


Yup, we're a unix only shop.


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