[Cmake] FindPython + cygwin

Mathieu Malaterre Mathieu . Malaterre at creatis . insa-lyon . fr
Fri, 10 Oct 2003 15:30:11 +0200


This is a multi-part message in MIME format.
--------------040702090601040205070201
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit

Hi all,

	I would like to suggest this patch for the FindPythonLibs package. It 
appears not to be able to find python lib on a cygwin system. On this 
system the lib is called:

	/usr/lib/python2.3/config/libpython2.3.dll.a

	Furthermore according to 'Mastering CMake' p68, lib var should be 
named: xxx_libraries. And finally I mark all the variables as advanced 
(not only on Win32).

HTH
mathieu

--------------040702090601040205070201
Content-Type: text/x-diff;
 name="python.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="python.patch"

Index: FindPythonLibs.cmake
===================================================================
RCS file: /cvsroot/CMake/CMake/Modules/FindPythonLibs.cmake,v
retrieving revision 1.15
diff -u -r1.15 FindPythonLibs.cmake
--- FindPythonLibs.cmake	3 Jan 2003 22:36:34 -0000	1.15
+++ FindPythonLibs.cmake	10 Oct 2003 13:37:19 -0000
@@ -3,13 +3,13 @@
 # include files and libraries are. It also determines what the name of
 # the library is. This code sets the following variables:
 #
-#  PYTHON_LIBRARY       = the full path to the library found
+#  PYTHON_LIBRARIES       = the full path to the library found
 #  PYTHON_INCLUDE_PATH  = the path to where tcl.h can be found
-#  PYTHON_DEBUG_LIBRARY = the full path to the debug library found
+#  PYTHON_DEBUG_LIBRARIES = the full path to the debug library found
 #
 
 IF(WIN32)
-  FIND_LIBRARY(PYTHON_DEBUG_LIBRARY 
+  FIND_LIBRARY(PYTHON_DEBUG_LIBRARIES 
     NAMES python23_d python22_d python21_d python20_d python 
     PATHS
     [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\2.3\\InstallPath]/libs/Debug
@@ -27,7 +27,7 @@
   )
 ENDIF(WIN32)
 
-FIND_LIBRARY(PYTHON_LIBRARY 
+FIND_LIBRARY(PYTHON_LIBRARIES 
   NAMES python23 python2.3 python22 python2.2 python21 python2.1 
         python20 python2.0 python16 python1.6 python15 python1.5
   PATHS
@@ -78,13 +78,26 @@
   [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\1.5\\InstallPath]/include
 )
 
-IF (WIN32)
-  MARK_AS_ADVANCED(
-    PYTHON_DEBUG_LIBRARY 
-    PYTHON_LIBRARY 
-    PYTHON_INCLUDE_PATH
+IF(CYGWIN)
+  FIND_LIBRARY(PYTHON_LIBRARIES 
+    NAMES python2.3.dll python2.2.dll python2.1.dll
+          python2.0.dll python1.6.dll python1.5.dll
+    PATHS
+    /usr/lib/python2.3/config
+    /usr/lib/python2.2/config
+    /usr/lib/python2.1/config
+    /usr/lib/python2.0/config
+    /usr/lib/python1.6/config
+    /usr/lib/python1.5/config
   )
-ENDIF(WIN32)
+ENDIF(CYGWIN)
+
+MARK_AS_ADVANCED(
+    PYTHON_DEBUG_LIBRARIES 
+    PYTHON_LIBRARIES 
+    PYTHON_INCLUDE_PATH
+)
+
 
 # Python Should be built and installed as a Framework on OSX
 IF (APPLE)
@@ -95,15 +108,15 @@
     SET(PYTHON_HAVE_FRAMEWORK 1)
   ENDIF(EXISTS /Library/Frameworks/Python.framework)
   IF("${PYTHON_INCLUDE_PATH}" MATCHES "Python\\.framework")
-    SET(PYTHON_LIBRARY "")
-    SET(PYTHON_DEBUG_LIBRARY "")
+    SET(PYTHON_LIBRARIES "")
+    SET(PYTHON_DEBUG_LIBRARIES "")
   ENDIF("${PYTHON_INCLUDE_PATH}" MATCHES "Python\\.framework")
   IF(PYTHON_HAVE_FRAMEWORK)
-    IF(NOT PYTHON_LIBRARY)
-      SET (PYTHON_LIBRARY "-framework Python" CACHE FILEPATH "Python Framework" FORCE)
-    ENDIF(NOT PYTHON_LIBRARY)
-    IF(NOT PYTHON_DEBUG_LIBRARY)
-      SET (PYTHON_DEBUG_LIBRARY "-framework Python" CACHE FILEPATH "Python Framework" FORCE)
-    ENDIF(NOT PYTHON_DEBUG_LIBRARY)
+    IF(NOT PYTHON_LIBRARIES)
+      SET (PYTHON_LIBRARIES "-framework Python" CACHE FILEPATH "Python Framework" FORCE)
+    ENDIF(NOT PYTHON_LIBRARIES)
+    IF(NOT PYTHON_DEBUG_LIBRARIES)
+      SET (PYTHON_DEBUG_LIBRARIES "-framework Python" CACHE FILEPATH "Python Framework" FORCE)
+    ENDIF(NOT PYTHON_DEBUG_LIBRARIES)
   ENDIF(PYTHON_HAVE_FRAMEWORK)
 ENDIF (APPLE)

--------------040702090601040205070201--