]> Creatis software - gdcm.git/blobdiff - gdcmPython/CMakeLists.txt
COMP: Get rid of: Warning(510): friend function 'operator <<' ignored.
[gdcm.git] / gdcmPython / CMakeLists.txt
index 23c9ce455e5f603294e85dea4b0c4db2eb0ff3b9..ba6957394782755a5969540ee17088996ffde128 100644 (file)
@@ -13,7 +13,8 @@ INCLUDE_DIRECTORIES(
 # CMake 2.0 will fully support Swig wrapping so split based on cmake version:
 
 # We need to pass that to swig to be sure all modules are generated in the proper dir
-SET(CMAKE_SWIG_FLAGS "-outdir ${GDCM_BINARY_DIR}/gdcmPython")
+SET(CMAKE_SWIG_FLAGS "-outdir \"${GDCM_BINARY_DIR}/gdcmPython\"")
+#SET(CMAKE_SWIG_OUTDIR "${GDCM_BINARY_DIR}/gdcmPython")
 # Looks like a bug to me in cmake 2.0.x:
 SEPARATE_ARGUMENTS(CMAKE_SWIG_FLAGS)
 
@@ -129,27 +130,29 @@ ELSE(WIN32)
        "${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")
+# Install a python path file in site-packages that tells
+# python where to find the gdcmPython module
+IF(UNIX)
+  FIND_PATH(PYTHON_DIR "site-packages"
+     /usr/lib/python2.4
+     /usr/lib/python2.3
+     /usr/lib/python2.2
+     /usr/lib/python2.1
+  ) 
+  STRING(REGEX REPLACE "/usr" "" PYTHON_DIR ${PYTHON_DIR})
+
+  INSTALL_FILES(${PYTHON_DIR}/site-packages FILES 
+    "${GDCM_BINARY_DIR}/gdcmPython/gdcmPython.pth"
+  )
+  INSTALL_FILES(/lib/gdcm/gdcmPython FILES 
+    "gdcm.py" 
+    "__init__.py" 
+    "gdcmVersion.py" 
+    "core.py" 
+    "vtk.py"
+  )
+ENDIF(UNIX)
 
 #-----------------------------------------------------------------------------
 # Add test from demo subdir: