[CMake] EXECUTE_PROCESS - I can't copy files on Windows
Filipe Sousa
natros at gmail.com
Tue Mar 20 13:33:16 EST 2007
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Vitor Vasconcelos Araujo Silva wrote:
> Hello all,
>
> I'm experiencing a problem in EXECUTE_PROCESS command.
>
> My test set needs some image files to execute. On Linux, it works fine
> with "make test" because I use the same directory to source code and to
> build.
> On Windows (Visual Studio) the file is built in the /Release directory.
> It's not a problem, but I have to copy the image files that are inside
> the SOURCE_DIR to BINARY_DIR. Otherwise, the RUN_TESTS project reports
> an execution error (of course, the files are missing. If a manually copy
> them inside the directory, it works fine). I use the code below:
>
> IF (WIN32)
>
> STRING (REGEX REPLACE "/" "\\\\" TESTSUITE_SOURCE_DIR_WINDOWS
> ${TESTSUITE_SOURCE_DIR})
>
> STRING (REGEX REPLACE "/" "\\\\" TESTSUITE_BINARY_DIR_WINDOWS
> ${TESTSUITE_BINARY_DIR})
>
> SET (ARGS_PBM_COPY \"${TESTSUITE_SOURCE_DIR_WINDOWS}*.pbm\" " "
> \"${TESTSUITE_BINARY_DIR_WINDOWS}\")
You can convert to native paths with FILE(TO_NATIVE_PATH path result)
> MESSAGE ("--- Copying TEST files arguments needed to performe unit
> tests...")
> MESSAGE ("copy " ${ARGS_PBM_COPY})
>
> EXECUTE_PROCESS(COMMAND copy ${ARGS_PBM_COPY}
> RESULT_VARIABLE result)
try ${CMAKE_COMMAND} -E copy (or copy_if_different) instead a see if it
works.
> MESSAGE ("My result: " ${result})
>
> ENDIF (WIN32)
>
> I tested all strings and they works well when I try them by hand.
> To clarify a little bit more, my "result" is: Impossible to find files.
> If I try the ERROR_VARIABLE, nothing is set.
> I tried before the EXEC_PROGRAM command as in the Mastering CMake book
> chaging after to EXECUTE_PROCESS. The both gave me the same errors.
> I'm using Windows XP.
> On Linux I don't need to copy the files, but as a test, I've tried and
> it worked as well (not copy, but cp).
> Am I doing something wrong? Or that are any better options?
> Thanks in advance,
>
> Vitor Vasconcelos
> INRIA Lorraine
> _______________________________________________
> CMake mailing list
> CMake at cmake.org
> http://www.cmake.org/mailman/listinfo/cmake
>
- --
Filipe Sousa
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
iD8DBQFGACjsbQdNYqwwwCwRAqhdAJ4p9luO3HVWRh5iHwgBmLZU0oEGCQCdEtWR
1W+N27G5sXw73voT7mU35ME=
=ONKg
-----END PGP SIGNATURE-----
More information about the CMake
mailing list