View Issue Details [ Jump to Notes ] | [ Print ] |
ID | Project | Category | View Status | Date Submitted | Last Update |
0010068 | CMake | Modules | public | 2009-12-18 19:00 | 2011-05-02 14:45 |
|
Reporter | Peter Collingbourne | |
Assigned To | Marcus D. Hanwell | |
Priority | normal | Severity | minor | Reproducibility | always |
Status | closed | Resolution | fixed | |
Platform | | OS | | OS Version | |
Product Version | CMake-2-8 | |
Target Version | | Fixed in Version | CMake 2.8.3 | |
|
Summary | 0010068: Use Python naming convention for extension modules created using PYTHON_ADD_MODULE |
Description | It would be nice if Python extension modules declared using PYTHON_ADD_MODULE and built as a shared object were named using the correct naming conventions (i.e. no lib prefix, .pyd suffix on Windows) so that Python can find them automatically. I am attaching a patch which modifies PYTHON_ADD_MODULE to set an appropriate PREFIX and SUFFIX based on the platform.
This has been tested on Windows and Linux, I am unaware of the conventions on other platforms. |
Tags | No tags attached. |
|
Attached Files | 0002-Use-Python-naming-convention-for-extension-modules-c.patch [^] (1,213 bytes) 2009-12-18 19:01 [Show Content] [Hide Content]From 93895d40cd1498b78f5d88202c0d22e320a382a7 Mon Sep 17 00:00:00 2001
From: Peter Collingbourne <peter@pcc.me.uk>
Date: Fri, 18 Dec 2009 06:20:18 +0000
Subject: [PATCH 2/3] Use Python naming convention for extension modules created using PYTHON_ADD_MODULE
Changed the PYTHON_ADD_MODULE function in FindPythonLibs to set an
appropriate PREFIX and SUFFIX for extension modules compiled as shared
object files that reflects the Python naming conventions.
---
Modules/FindPythonLibs.cmake | 6 ++++++
1 files changed, 6 insertions(+), 0 deletions(-)
diff --git a/Modules/FindPythonLibs.cmake b/Modules/FindPythonLibs.cmake
index 5c99e3f..243d07a 100644
--- a/Modules/FindPythonLibs.cmake
+++ b/Modules/FindPythonLibs.cmake
@@ -141,6 +141,12 @@ FUNCTION(PYTHON_ADD_MODULE _NAME )
ADD_LIBRARY(${_NAME} ${PY_MODULE_TYPE} ${ARGN})
# TARGET_LINK_LIBRARIES(${_NAME} ${PYTHON_LIBRARIES})
+ IF(PYTHON_MODULE_${_NAME}_BUILD_SHARED)
+ SET_TARGET_PROPERTIES(${_NAME} PROPERTIES PREFIX "")
+ IF(WIN32 AND NOT CYGWIN)
+ SET_TARGET_PROPERTIES(${_NAME} PROPERTIES SUFFIX ".pyd")
+ ENDIF()
+ ENDIF()
ENDIF(PYTHON_ENABLE_MODULE_${_NAME})
ENDFUNCTION(PYTHON_ADD_MODULE)
--
1.6.3.3
|
|