]> Creatis software - gdcm.git/blobdiff - Dicts/CMakeLists.txt
Comments
[gdcm.git] / Dicts / CMakeLists.txt
index 6ad0a9f335b712f608489e0919130547c1297b1e..c80ef577b0c69c6a12984014581c8886da3daa0d 100644 (file)
@@ -1,22 +1,37 @@
 #-----------------------------------------------------------------------------
 # DICOM dictionary stuff
 
+#-----------------------------------------------------------------------------
+# Generate our own 'DICOM' dictionary, based on the following dictionaries:
+SET(ALL_DICTS
+  dicomV3.dic
+  Papyrus.dic
+  NIH.dic     #the forbidden one...
+  SPI.dic
+  #  PHILIPS-Intera.dic # uncomment me if you want
+  )
 
-INSTALL_FILES(${GDCM_DATA_DIR} .dic
-  dicomV3
-  dicomVR
-  dicomTS
-  DicomDir
-  DictGroupName
-)
+# Better solution
+SET(TEST_DICT_BODY)
+FOREACH(dict ${ALL_DICTS})
+  # Properly set dependencies, therefore `touch Philips-Intera.dic` does not rebuild
+  # but adding/removing a line in Philips-Intera.dic rebuild as expected
+  CONFIGURE_FILE("${GDCM_SOURCE_DIR}/Dicts/${dict}"
+       "${GDCM_BINARY_DIR}/Dicts/${dict}" COPYONLY IMMEDIATE)
+  FILE(READ "${GDCM_SOURCE_DIR}/Dicts/${dict}" dict_append)
+  SET(TEST_DICT_BODY "${TEST_DICT_BODY}\n${dict_append}")
+ENDFOREACH(dict)
+CONFIGURE_FILE("${GDCM_SOURCE_DIR}/Dicts/gdcm.dic.in"
+  "${GDCM_BINARY_DIR}/Dicts/gdcm.dic" @ONLY IMMEDIATE)
 
+#-----------------------------------------------------------------------------
 # Nice trick to avoid creating a .h file each time we compile gdcm
 # Since CONFIGURE_FILE do a 'copy if different'
 # We have to write the file here since is contains 'DICOM_DICTIONARY'
 # Which is a variable afterward...
 
 # Following code contributing by Andy Cedilnik (Kitware)
-FILE(READ "dicomV3.dic" ENT)
+FILE(READ "${GDCM_BINARY_DIR}/Dicts/gdcm.dic" ENT)
 STRING(REGEX REPLACE "\r?\n" ";" ENT "${ENT}")
 SET(DICOM_DATA_DICTIONARY "")
 
@@ -88,23 +103,16 @@ ENDFOREACH(line)
 # ... Set the dictionnary
 SET(DICOM_DIR_DICTIONARY "${DICOM_DIR_DICTIONARY} \n {0,0,0,0}")
 
-FOREACH(file dicomV3.dic  dicomTS.dic dicomVR.dic DicomDir.dic DictGroupName.dic)
-  CONFIGURE_FILE("${GDCM_SOURCE_DIR}/Dicts/${file}"
-    "${GDCM_BINARY_DIR}/Dicts/${file}.out")
-ENDFOREACH(file)
 CONFIGURE_FILE("${GDCM_SOURCE_DIR}/src/gdcmDefaultDicts.cxx.in" 
   "${GDCM_BINARY_DIR}/src/gdcmDefaultDicts.cxx" IMMEDIATE)
 
 #-----------------------------------------------------------------------------
-# Now generate our own 'DICOM' dictionary, based on the following dictionaries:
-SET(ALL_DICTS
-  dicomV3.dic
-  Papyrus.dic
-  NIH.dic     #the forbidden one...
-  )
-
-FOREACH(dict ${ALL_DICTS})
-  FILE(READ "${GDCM_SOURCE_DIR}/Dicts/${dict}" dict_append)
-  FILE(APPEND "${GDCM_BINARY_DIR}/Dicts/gdcm.dic" ${dict_append})
-ENDFOREACH(dict)
+INSTALL_FILES(${GDCM_DATA_DIR} .dic
+  dicomV3
+  dicomVR
+  dicomTS
+  DicomDir
+  DictGroupName
+  gdcm
+)