Re: [CMake] Native Pathsupport under Windows

2007-10-24 Thread alexander
Hi,


 To copy files, use ${CMAKE_COMMAND} -E copy.

He doesn't just want to copy files, he wants to concatenate two files (copy 
file1+file2 destfile).  I doesn't look like cmake provides a built in cmake 
-E command for that.

One possibility is to use a separate cmake script to do the concatenation and 
run it as a command:

cmake_concatenate.cmake

EXECUTE_PROCESS(  COMMAND  ${CMAKE_COMMAND} -E copy ${FILE1} $ 
{DEST_FILE})
FILE(READ ${FILE2} file2_contents)
FILE(APPEND ${DEST_FILE} ${file2_contents})

call it from regular CMakeLists.txt file

COMMAND ${CMAKE_COMMAND}
ARGS -P cmake_concatenate.cmake -DFILE1:STRING=${RESULT}/image.h - 
 DFILE2:STRING=${RESULT}/test.h -DDEST_FILE:STRING=${RESULT}/image.h
In this particular case the destination and the first source file are the 
same, so a modified cmake_concatenate.cmake file could be more appropriate.

That doesn't work. I think it is the same problem why I can't use FILE() at all.
Because the file i want to append is both, generated before and used as a 
source file.

Greetings

Alexander
___
CMake mailing list
CMake@cmake.org
http://www.cmake.org/mailman/listinfo/cmake


Re: [CMake] Native Pathsupport under Windows

2007-10-24 Thread alexander
Hi all,
Hi Brandon,

You'll need to write your own native path function for MinGW generator
as a workaround.  STRING(REPLACE / \\ native_path ${cmake_path})
will probably do it, but maybe there's more to it.  It's been awhile
since I messed with these.

Works great, now i can do a native append.

Thanks for your help.

Greetings

Alexander
___
CMake mailing list
CMake@cmake.org
http://www.cmake.org/mailman/listinfo/cmake


Re: [CMake] Native Pathsupport under Windows

2007-10-24 Thread Brandon Van Every
On 10/24/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:

 That doesn't work. I think it is the same problem why I can't use FILE() at 
 all.
 Because the file i want to append is both, generated before and used as a
 source file.

You'll need to write your own native path function for MinGW generator
as a workaround.  STRING(REPLACE / \\ native_path ${cmake_path})
will probably do it, but maybe there's more to it.  It's been awhile
since I messed with these.


Cheers,
Brandon Van Every
___
CMake mailing list
CMake@cmake.org
http://www.cmake.org/mailman/listinfo/cmake


[CMake] Native Pathsupport under Windows

2007-10-23 Thread alexander
Hello List,

I need to use under windows the buildin commands of the shell. But when I run 
these commands they doesn't work correctly, because the windows commands doen't 
like the slashes (/). It seems to me that they want to get backslashes (\).

A example:

ADD_CUSTOM_COMMAND(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/image.h
   COMMAND copy 
${CMAKE_CURRENT_BINRAR_DIR}/image.h+${CMAKE_CURRENT_BINARY_DIR}/test.h 
${CMAKE_CURRENT_BINRAR_DIR}/image.h)

Then the shell says:
copy C:/Projects/build/image.h+C:/Projects/build/test.h 
C:/Projects/build//image.h
The syntax of the command is incorrect.

Do i the same in a command line with normal windows backslashes in paths, then 
everything is fine.

BTW. I do that with the buildin copy, because in the documentation at 
file(append) there is a note which says, i am not allowed to use the generated 
file as an input. But i need that generated file to compile my lib.

1. Is there a possiblity to get backslashes instead of slashes as paths?

2. Maybe is there a better way to solve that kind of problem?

Thanks for all your help

Greetings

Alexander
___
CMake mailing list
CMake@cmake.org
http://www.cmake.org/mailman/listinfo/cmake


RE: [CMake] Native Pathsupport under Windows

2007-10-23 Thread Torsten Martinsen
[EMAIL PROTECTED]  wrote:

 I need to use under windows the buildin commands of the shell. But
 when I run these commands they doesn't work correctly, because the
 windows commands doen't like the slashes (/). It seems to me that
 they want to get backslashes (\).

 1. Is there a possiblity to get backslashes instead of slashes as
 paths?

FILE(TO_NATIVE_PATH ...)

-Torsten

This e-mail and any files sent with it contain information that may be 
privileged or confidential and is the property of the GateHouse Group. This 
information is intended solely for the person to whom it is addressed. If you 
are not the intended recipient, you are not authorized to read, print, retain, 
copy, disseminate, distribute, or use the message or any part thereof. If you 
have received this e-mail in error, please notify the sender immediately, and 
delete all copies of this message. In accordance with GateHouse Security 
Policy, e-mails sent or received may be monitored.
___
CMake mailing list
CMake@cmake.org
http://www.cmake.org/mailman/listinfo/cmake


RE: [CMake] Native Pathsupport under Windows

2007-10-23 Thread alexander
Hi,

 I need to use under windows the buildin commands of the shell. But
 when I run these commands they doesn't work correctly, because the
 windows commands doen't like the slashes (/). It seems to me that
 they want to get backslashes (\).

 1. Is there a possiblity to get backslashes instead of slashes as
 paths?

 FILE(TO_NATIVE_PATH ...)

When I do a FILE(TO_NATIVE_PATH ${CMAKE_CURRENT_BINARY_DIR} RESULT)
and then use ${RESULT} I get the whole again with slashes.
So I can't use that with custom_command:
ADD_CUSTOM_COMMAND(...
COMMAND copy ${RESULT}\\image.h+${RESULT}\\test.h ${RESULT}\\image.h
VERBATIM)

Even without VERBATIM I get both times the already given error.

Greetings

Alexander
___
CMake mailing list
CMake@cmake.org
http://www.cmake.org/mailman/listinfo/cmake


Re: [CMake] Native Pathsupport under Windows

2007-10-23 Thread James Bigler


On Oct 23, 2007, at 7:13 AM, Torsten Martinsen wrote:


[EMAIL PROTECTED]  wrote:


FILE(TO_NATIVE_PATH ...)


When I do a FILE(TO_NATIVE_PATH ${CMAKE_CURRENT_BINARY_DIR} RESULT)
and then use ${RESULT} I get the whole again with slashes.
So I can't use that with custom_command:
ADD_CUSTOM_COMMAND(...
COMMAND copy ${RESULT}\\image.h+${RESULT}\\test.h ${RESULT}\\image.h
VERBATIM)


To copy files, use ${CMAKE_COMMAND} -E copy.


He doesn't just want to copy files, he wants to concatenate two files  
(copy file1+file2 destfile).  I doesn't look like cmake provides a  
built in cmake -E command for that.


One possibility is to use a separate cmake script to do the  
concatenation and run it as a command:


cmake_concatenate.cmake

EXECUTE_PROCESS(  COMMAND  ${CMAKE_COMMAND} -E copy ${FILE1} $ 
{DEST_FILE})


FILE(READ ${FILE2} file2_contents)
FILE(APPEND ${DEST_FILE} ${file2_contents})


call it from regular CMakeLists.txt file

   COMMAND ${CMAKE_COMMAND}
   ARGS -P cmake_concatenate.cmake -DFILE1:STRING=${RESULT}/image.h - 
DFILE2:STRING=${RESULT}/test.h -DDEST_FILE:STRING=${RESULT}/image.h


In this particular case the destination and the first source file are  
the same, so a modified cmake_concatenate.cmake file could be more  
appropriate.


James
___
CMake mailing list
CMake@cmake.org
http://www.cmake.org/mailman/listinfo/cmake


Re: [CMake] Native Pathsupport under Windows

2007-10-23 Thread Brandon Van Every
On 10/23/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
 Hi,

  I need to use under windows the buildin commands of the shell. But
  when I run these commands they doesn't work correctly, because the
  windows commands doen't like the slashes (/). It seems to me that
  they want to get backslashes (\).

  1. Is there a possiblity to get backslashes instead of slashes as
  paths?

  FILE(TO_NATIVE_PATH ...)

 When I do a FILE(TO_NATIVE_PATH ${CMAKE_CURRENT_BINARY_DIR} RESULT)
 and then use ${RESULT} I get the whole again with slashes.

You have found a bug, which I have filed as
http://cmake.org/Bug/view.php?id=5939

FILE(TO_NATIVE_PATH ${CMAKE_CURRENT_SOURCE_DIR} native_srcdir)
MESSAGE(${native_srcdir})

under a MinGW Makefiles generator produces
C:/devel/src/bugs/native.  This is wrong.  A Visual Studio 8 2005
generator produces C:\devel\src\bugs\native, the correct result.


Cheers,
Brandon Van Every
___
CMake mailing list
CMake@cmake.org
http://www.cmake.org/mailman/listinfo/cmake