]> Creatis software - gdcm.git/blobdiff - Testing/CMakeLists.txt
Forget this one
[gdcm.git] / Testing / CMakeLists.txt
index c273c1d508d4be997e21dce06a6e1c37d55e85a3..aff9d67aaf65cbac9c5a86500a9987fec10f9562 100644 (file)
@@ -1,41 +1,40 @@
-#For later : rewrite this things for more consistencies, such as a 'FOREACH'
+# TODO:
+# http://www.cmake.org/pipermail/cmake/2001-November/002491.html
+# So that dll is copied to each subdir where needed
 
-LINK_LIBRARIES(gdcm)
-INCLUDE_DIRECTORIES(
-  ${GDCM_SOURCE_DIR}/src/
-)
+INCLUDE (${CMAKE_ROOT}/Modules/CheckIncludeFile.cmake)
+CHECK_INCLUDE_FILE("stdint.h"    CMAKE_HAVE_STDINT_H)
 
-SET(PrintHeader_SOURCES
-  PrintHeader.cxx
-)
-ADD_EXECUTABLE(PrintHeader ${PrintHeader_SOURCES})
+IF(NOT CMAKE_HAVE_STDINT_H)
+  SET(GDCM_TEST_COMPILE_FLAGS "-DHAVE_NO_STDINT_H")
+ENDIF(NOT CMAKE_HAVE_STDINT_H)
 
-SET(testWrite_SOURCES
-  testWrite.cxx
-)
-ADD_EXECUTABLE(testWrite ${testWrite_SOURCES})
 
-SET(testChangeEntete_SOURCES
+SET(TEST_SOURCES
+  PrintHeader.cxx
+  testWrite.cxx
   testChangeEntete.cxx
-)
-ADD_EXECUTABLE(testChangeEntete ${testChangeEntete_SOURCES})
-
-SET(hashtest_SOURCES
   hashtest.cxx
-)
-ADD_EXECUTABLE(hashtest ${hashtest_SOURCES})
-
-SET(bug1_SOURCES
   bug1.cxx
-)
-ADD_EXECUTABLE(bug1 ${bug1_SOURCES})
-
-SET(pourFindTaggs_SOURCES
   pourFindTaggs.cxx
+  dcm2acr.cxx
 )
-ADD_EXECUTABLE(pourFindTaggs ${pourFindTaggs_SOURCES})
 
-SET(dcm2acr_SOURCES
-  dcm2acr.cxx
+# include stuff
+INCLUDE_DIRECTORIES(
+  ${GDCM_SOURCE_DIR}/src/
 )
-ADD_EXECUTABLE(dcm2acr ${dcm2acr_SOURCES})
+
+# Loop over files and create executables
+FOREACH(file ${TEST_SOURCES})
+  #Doh ! I need to specify each time the compile flags !
+  IF(GDCM_TEST_COMPILE_FLAGS)
+  SET_SOURCE_FILES_PROPERTIES(${file}
+    PROPERTIES
+    COMPILE_FLAGS ${GDCM_TEST_COMPILE_FLAGS}
+  )
+  ENDIF(GDCM_TEST_COMPILE_FLAGS)
+  GET_FILENAME_COMPONENT(name ${file} NAME_WE)
+  ADD_EXECUTABLE(${name} ${file})
+  TARGET_LINK_LIBRARIES(${name} gdcm)
+ENDFOREACH(file ${TEST_SOURCES})