+ ADD_LIBRARY(pygdcm gdcm_wrap.cxx)
+ TARGET_LINK_LIBRARIES(pygdcm
+ ${PYTHON_LIBRARY}
+ gdcm
+ )
+ # http://www.cmake.org/pipermail/cmake/2003-August/004190.html
+ #SET_TARGET_PROPERTIES(pygdcm PROPERTIES PREFIX "_")
+
+ # This swig command will also outputs gdcm.py :
+ SET_SOURCE_FILES_PROPERTIES(${GDCM_BINARY_DIR}/gdcmPython/gdcm.py GENERATED)
+
+ # Instead of a simple copy operation let create our own gdcm.py file:
+ # First read what swig dumped:
+ IF(EXISTS ${GDCM_BINARY_DIR}/gdcmPython/gdcm.py)
+ FILE(READ ${GDCM_BINARY_DIR}/gdcmPython/gdcm.py SWIG_GDCM_PY)
+ ENDIF(EXISTS ${GDCM_BINARY_DIR}/gdcmPython/gdcm.py)
+
+ # Then create the gdcm.py = gdcmVersion.py + gdcm.py (swig) file:
+ FILE(WRITE ${GDCM_BINARY_DIR}/bin/gdcmVersion.py
+ "import os\n"
+ "gdcmVERSION=\"${GDCM_VERSION}\"\n"
+ "GDCM_DATA_PATH=\"${GDCM_DATA_ROOT}\"\n\n"
+ ${SWIG_GDCM_PY}
+ )
+
+ # Seems like they want instead a file called gdcmPython.py
+ # Thus add the custom command to copy it to proper location:
+# ADD_CUSTOM_COMMAND(
+# TARGET pygdcm
+# POST_BUILD
+# COMMAND ${CMAKE_COMMAND}
+# ARGS -E copy
+# ${GDCM_BINARY_DIR}/bin/gdcm.py
+# ${GDCM_BINARY_DIR}/bin/gdcmPython.py
+# )