[CMake] Test Script problems on Windows

Allen D Byrne byrn at hdfgroup.org
Wed May 5 14:57:52 EDT 2010


As stated in my previous post, I have a script, named runTest.cmake, which works on linux but fails on Windows with:
     "The process cannot access the file because it is being used by another process"
This script calls execute_process() with an executable to capture the output for a comparison later. This script is invoked in a CMakeLists.txt file:
---------------------------------------------------------
...
MACRO (ADD_CMP_TEST resultfile resultcode)
    ADD_TEST (
        NAME TOOL-${resultfile}
        COMMAND "${CMAKE_COMMAND}"
            -D "TEST_PROGRAM=$<TARGET_FILE:tool>"
            -D "TEST_ARGS=${ARGN}"
            -D "TEST_FOLDER=${PROJECT_BINARY_DIR}"
            -D "TEST_OUTPUT=${resultfile}.out"
            -D "TEST_EXPECT=${resultcode}"
            -D "TEST_REFERENCE=${resultfile}.txt"
            -D "TEST_APPEND=EXIT CODE:"
            -P "runTest.cmake"
    )
  ENDMACRO (ADD_CMP_TEST file)

...

ADD_CMP_TEST (tool_11 1  tool_param1 tool_param2 tool_paramN)
---------------------------------------------------------------------------------  
BTW, if I can run the command and args on the command line just fine.
I will consider any alternatives to the script even two ADD_TEST() calls. The primary need is to capture the output of the executable in a file.

Allen



More information about the CMake mailing list