[CMake] EXECUTE_PROCESS - I can't copy files on Windows

Vitor Vasconcelos Araujo Silva vasconcv at loria.fr
Wed Mar 21 08:15:20 EST 2007


	Shame on me, reply my own post, but I fixed the small error, but I'm 
still no able to copy files:

	The code follows:

      EXECUTE_PROCESS(COMMAND ${CMAKE_COMMAND} -E copy teste.txt mytest
		RESULT_VARIABLE resultado
		ERROR_VARIABLE erro )

      MESSAGE ("resultado: " ${resultado})
      MESSAGE ("erro: " ${erro})

	I tried too change ${CMAKE_COMMAND} to only cmake and got the same error.

C:\Documents and Settings\vasconcv\work\conta\mylib>cmake .
-- Who am I? Windows
--- Copying TEST files arguments needed to performe unit tests...
resultado: 1
erro: Error copying file "teste.txt" to "mytest".

-- Configuring done
-- Generating done
-- Build files have been written to: C:/Documents and 
Settings/vasconcv/work/conta/mylib

C:\Documents and Settings\vasconcv\work\conta\mylib>

	Thanks a lot,

	Vitor

Vitor Vasconcelos Araujo Silva a écrit:

> 
>> You can convert to native paths with FILE(TO_NATIVE_PATH path result)
> 
> 
>     Thanks Filipe. Much more "cleaner" way.
>     I was using only the Mastering CMake book, but I'm observing a lot of
> improvements from 2.2 to 2.4 version. Now I'll always look at CMake help.
> 
>> try ${CMAKE_COMMAND} -E copy (or copy_if_different) instead a see if it
>> works.
>>
>     Well, unfortunaly, no. I tried a simpler command, that copies only one
> file that is located in actual directory to my test directory.
>     My structure is that:
>     
>     C:\...\mylib
>     C:\...\mylib\mytest
> 
>     I tried:
> 
>      EXECUTE_PROCESS(${CMAKE_COMMAND} -E copy "teste.txt" "mytest"
>         RESULT_VARIABLE resultado
>         ERROR_VARIABLE erro )
> 
>      MESSAGE ("resultado: " ${resultado})
>      MESSAGE ("erro: " ${erro})
> 
>     (I have the teste.txt file inside mylib dir)
>     I got the following error:
> 
> C:\Documents and Settings\vasconcv\work\conta\mylib>cmake .
> -- Who am I? Windows
> --- Copying TEST files arguments needed to performe unit tests...
> conversao Z:\Qgar\mylib
> conversao C:\Documents and Settings\vasconcv\work\conta\mylib
> CMake Error: Error in cmake code at
> Z:/Qgar/qgarlib/testsuite/CMakeLists.txt:203:
> EXECUTE_PROCESS  given unknown argument "C:/Program Files/CMake
> 2.4/bin/cmake.exe".
> Current CMake stack: Z:/Qgar/mylib/mytest/CMakeLists.txt
> resultado:
> erro:
> -- Configuring done
> 
> C:\Documents and Settings\vasconcv\work\conta\mylib>
> 
>     When I tried "by hand" in command line:
> 
>     cmake -E copy teste.txt mytest
> 
>     It worked fine.
>     Thanks a lot and I hope to get a solution. It seems not to be a big
> problem, is it?
> 
>     Vitor Vasconcelos
> 
> 
> _______________________________________________
> CMake mailing list
> CMake at cmake.org
> http://www.cmake.org/mailman/listinfo/cmake


More information about the CMake mailing list