]> Creatis software - gdcm.git/blob - Testing/CMakeLists.txt
Fix warnings, add a GDCM_DATA_ROOT to CMake
[gdcm.git] / Testing / CMakeLists.txt
1 # TODO:
2 # http://www.cmake.org/pipermail/cmake/2001-November/002491.html
3 # So that dll is copied to each subdir where needed
4
5 SET(CXX_TEST_PATH ${EXECUTABLE_OUTPUT_PATH})
6
7 SET(GDCM_TESTS ${CXX_TEST_PATH}/gdcmTests)
8
9 INCLUDE (${CMAKE_ROOT}/Modules/CheckIncludeFile.cmake)
10 CHECK_INCLUDE_FILE("stdint.h"    CMAKE_HAVE_STDINT_H)
11
12 IF(NOT CMAKE_HAVE_STDINT_H)
13   SET(GDCM_TEST_COMPILE_FLAGS "-DHAVE_NO_STDINT_H")
14 ENDIF(NOT CMAKE_HAVE_STDINT_H)
15
16
17 SET(TEST_SOURCES
18   PrintHeader.cxx #require test.acr
19   bug1.cxx        #require test.acr
20   dcm2acr.cxx     #require test.acr
21   hashtest.cxx
22   makeDicomDir.cxx
23   testDicomDir.cxx
24   testWrite.cxx
25 )
26 IF (GDCM_DATA_ROOT)
27         # add tests that require data
28         SET(TEST_SOURCES ${TEST_SOURCES}     
29           PrintDicomDir.cxx
30     pourFindTaggs.cxx
31     testChangeEntete.cxx
32   )
33 ENDIF (GDCM_DATA_ROOT)
34
35 # include stuff
36 INCLUDE_DIRECTORIES(
37   ${GDCM_SOURCE_DIR}/src/
38 )
39
40 # Loop over files and create executables
41 FOREACH(file ${TEST_SOURCES})
42   #Doh ! I need to specify each time the compile flags !
43   IF(GDCM_TEST_COMPILE_FLAGS)
44   SET_SOURCE_FILES_PROPERTIES(${file}
45     PROPERTIES
46     COMPILE_FLAGS ${GDCM_TEST_COMPILE_FLAGS}
47   )
48   ENDIF(GDCM_TEST_COMPILE_FLAGS)
49   GET_FILENAME_COMPONENT(name ${file} NAME_WE)
50   ADD_TEST(${name} ${GDCM_TESTS} ${name})
51 ENDFOREACH(file ${TEST_SOURCES})
52
53
54 ADD_EXECUTABLE(gdcmTests gdcmTests.cxx ${TEST_SOURCES})
55 TARGET_LINK_LIBRARIES(gdcmTests gdcm)
56
57