1 # CMakeLists for Testing purpose
2 # Cxx file that need a file to run should be place aproprietly
4 SET(CXX_TEST_PATH ${EXECUTABLE_OUTPUT_PATH})
6 SET(GDCM_TESTS ${CXX_TEST_PATH}/gdcmTests)
8 # add test that does not require data:
9 # They usally return if no argument is given
17 # add tests that require data
19 SET(TEST_SOURCES ${TEST_SOURCES}
20 PrintHeader.cxx #require test.acr
24 testDicomDir.cxx #require DICOMDIR
29 # add test that require VTK:
32 ${GDCM_SOURCE_DIR}/vtk/
34 SET(TEST_SOURCES ${TEST_SOURCES}
38 ENDIF (GDCM_DATA_ROOT)
44 ${GDCM_SOURCE_DIR}/src/
48 CREATE_TEST_SOURCELIST(Tests gdcmTests.cxx ${TEST_SOURCES})
49 ADD_EXECUTABLE(gdcmTests ${Tests})
51 TARGET_LINK_LIBRARIES(gdcmTests vtkgdcm vtkRendering)
53 TARGET_LINK_LIBRARIES(gdcmTests gdcm)
56 SET (TestsToRun ${Tests})
57 REMOVE (TestsToRun gdcmTests.cxx)
59 # Loop over files and create executables
60 FOREACH(file ${TEST_SOURCES})
61 GET_FILENAME_COMPONENT(name ${file} NAME_WE)
63 # ADD_TEST(${name} ${CXX_TEST_PATH}/gdcmTests ${name}
64 # -D ${GDCM_DATA_ROOT}
65 # -T ${GDCM_BINARY_DIR}/Testing/Temporary
66 # -V Baseline/gdcm/${name}.png)
67 # ELSE (GDCM_DATA_ROOT)
68 ADD_TEST(${name} ${GDCM_TESTS} ${name})
69 # ENDIF (GDCM_DATA_ROOT)
70 ENDFOREACH(file ${TEST_SOURCES})
72 #-----------------------------------------------------------------------------
74 # We need to test the reading of all dicom images in the gdcmData directory
75 # First parse this directory and extract all images
77 # For now only *.dcm will be picked up, since there is a bug in cmake 1.8.3
78 # and I don't know how to work around
79 FILE(GLOB GDCM_DATA_IMAGES_GLOB
80 "${GDCM_DATA_ROOT}/*.dcm"
81 # "${GDCM_DATA_ROOT}/*.acr"
84 # This is a GLOB expression, change it into a list separated with a comma and \n
86 FOREACH(filename ${GDCM_DATA_IMAGES_GLOB})
87 SET(GDCM_DATA_IMAGES "${GDCM_DATA_IMAGES}\n\"${filename}\",")
90 # Populate GDCM_DATA_IMAGES:
91 FILE(WRITE "${GDCM_BINARY_DIR}/gdcmDataImages.h.in"
92 "const char * const gdcmDataImages[] = { @GDCM_DATA_IMAGES@ \n 0 };"
95 # Generate the header file:
97 ${GDCM_BINARY_DIR}/gdcmDataImages.h.in
98 ${GDCM_BINARY_DIR}/gdcmDataImages.h