[CMake] runtime error of ctest in windows VS2005

Eric Noulard eric.noulard at gmail.com
Wed Jan 6 02:31:48 EST 2010


2010/1/6 Xi LIANG <liangxi1986317 at hotmail.com>:
> Dear all,
> Im using Windows and the compiler is VS2005. I wrote a CMakeLists.txt file
> to run a image registration program, which generates a executable named as
> FFD_3D_mask.exe. This executable takes  some arguments as names of input and
> output files. The CMake file is written as the following, and it runs
> properly and the generated executable also works fine by inputing the
> arguments manually in the command window.
> -----------------
> cmake_minimum_required(VERSION 2.8)
>
> PROJECT(FFD_3D_mask)
> FIND_PACKAGE(ITK)
> IF(ITK_FOUND)
> INCLUDE(${ITK_USE_FILE})
> ELSE(ITK_FOUND)
> MESSAGE(FATAL_ERROR
> "ITK not found. Please se t ITK_DIR.")
> ENDIF(ITK_FOUND)
> ADD_EXECUTABLE(FFD_3D_mask FFD_3D_mask.cxx )
> TARGET_LINK_LIBRARIES(FFD_3D_mask ITKCommon ITKIO ITKNumerics ITKStatistics)
> ------------
> Then I tried to automatically run the executable, without having to type the
> arguments manually everytime. Then I added the following lines. I build the
> executable first, and then build the RUN_TEST. The test is failed, and the
> error message is attached. I am not sure whether the code I wrote was wrong,
> or didnt build the test properly?

First I would avoid calling your test "RUN_TEST" knowing that the
CMake generated
target is called "RUN_TESTS" this can lead to confusion at most.
May be "GenMaskTest" or something more meaningfull would be good.

However this shouldn't be the problem root.

The default behavior of ctest is to check the returned value of the executable
is your executable returning something different from 0 when it succeed?

You said the test is failing but from what you give us we can only tell that
C Test believe the test is failing, however could you check whether if the test
is producing the expected files?

Did you look at the failed log inside
build\RUN_TESTS.dir\Debug\?

I don't know how to do it from within Visual Studio but if you open a
command line prompt
and change dir to you build dir:
file://c:\MRI\ITK\test\Registrati on\Deformable\3D_mask\build

you may try to run ctest manually with verbose option:

ctest -VV

this should show you more details on the execution.

-- 
Erk
Membre de l'April - « promouvoir et défendre le logiciel libre » -
http://www.april.org


More information about the CMake mailing list