-#I should install in path of PYTHON_LIBRARY
-#GET_FILENAME_COMPONENT(PYTHON_LIB_INSTALL ${PYTHON_LIBRARY} PATH)
-#GET_FILENAME_COMPONENT(SITEPACKAGE ${PYTHON_LIB_INSTALL}/../site-packages ABSOLUTE)
-#MESSAGE(STATUS ${SITEPACKAGE})
-#INSTALL_FILES(/include "\\.h$")
-#INSTALL_TARGETS(/lib/ gdcm)
-
-#INSTALL_TARGETS(/lib/ gdcm.py)
-# gdcm.py is a file generated by swig
-# then from python you can do import gdcm, and it will load _gdcm.so
-INSTALL_FILES(/lib/ .py gdcm.py)
-
-# When installing swig-generated python module one should pay attention
-# to library naming convention, see here for more detail:
-# http://www.swig.org/Doc1.3/Python.html#n6
-# even with the $swig -module mylib, there is always a trailing underscore added
+#-----------------------------------------------------------------------------
+# Python installation
+IF(WIN32)
+ FILE(WRITE ${GDCM_BINARY_DIR}/gdcmPython/gdcmPython.pth
+ "${GDCM_BINARY_DIR}\n"
+ "${GDCM_BINARY_DIR}/bin/release\n"
+ )
+ELSE(WIN32)
+ FILE(WRITE ${GDCM_BINARY_DIR}/gdcmPython/gdcmPython.pth
+ "${CMAKE_INSTALL_PREFIX}/lib/gdcm\n"
+ )
+ENDIF(WIN32)
+FIND_PATH(PYTHON_INSTALL "site-packages"
+ [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\2.4\\InstallPath]
+ [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\2.3\\InstallPath]
+ [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\2.2\\InstallPath]
+ [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\2.1\\InstallPath]
+ [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\2.0\\InstallPath]
+ [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\1.6\\InstallPath]
+ [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\1.5\\InstallPath]
+ /usr/lib/python2.4
+ /usr/lib/python2.3
+ /usr/lib/python2.2
+ /usr/lib/python2.1
+ /usr/lib/python2.0
+ /usr/lib/python1.6
+ /usr/lib/python1.5
+)
+STRING(REGEX REPLACE "/usr(.*)/config.*" "\\1" PYTHON_INSTALL ${PYTHON_LIBRARY})
+
+INSTALL_FILES(${PYTHON_INSTALL}/site-packages "\\.pth$")
+INSTALL_FILES(/lib/gdcm/gdcmPython "\\.py$")
+INSTALL_FILES(/lib/gdcm/gdcmPython FILES "gdcm.py")
+
+#-----------------------------------------------------------------------------
+# Add test from demo subdir:
+
+SUBDIRS(demo)