summaryrefslogtreecommitdiffstats
path: root/Modules/FindPythonLibs.cmake
diff options
context:
space:
mode:
authorAlexander Neundorf <neundorf@kde.org>2007-07-25 19:08:37 (GMT)
committerAlexander Neundorf <neundorf@kde.org>2007-07-25 19:08:37 (GMT)
commit7e9eed0230cf2ba8b86bcf76e1c78bb23fa8b82e (patch)
tree9440e97d7894cf78b417788ca7dac379a6f095a5 /Modules/FindPythonLibs.cmake
parent9c2d6f98d7e0fd42bcf2ec78fbd66190c6dc439e (diff)
downloadCMake-7e9eed0230cf2ba8b86bcf76e1c78bb23fa8b82e.zip
CMake-7e9eed0230cf2ba8b86bcf76e1c78bb23fa8b82e.tar.gz
CMake-7e9eed0230cf2ba8b86bcf76e1c78bb23fa8b82e.tar.bz2
COMP: same as in VTK, build modules by default as shared if the platform
supports this, don't include shared modules in the generated header Alex
Diffstat (limited to 'Modules/FindPythonLibs.cmake')
-rw-r--r--Modules/FindPythonLibs.cmake18
1 files changed, 10 insertions, 8 deletions
diff --git a/Modules/FindPythonLibs.cmake b/Modules/FindPythonLibs.cmake
index 4dff4db..029d0fd 100644
--- a/Modules/FindPythonLibs.cmake
+++ b/Modules/FindPythonLibs.cmake
@@ -93,17 +93,19 @@ IF(NOT _FIND_PYTHONLIBS_ALREADY_INCLUDED)
SET(PY_MODULES_LIST "" CACHE STRING "Collect a list of all added python modules" FORCE)
ENDIF(NOT _FIND_PYTHONLIBS_ALREADY_INCLUDED)
+GET_PROPERTY(_TARGET_SUPPORTS_SHARED_LIBS GLOBAL TARGET_SUPPORTS_SHARED_LIBS)
+
MACRO(PYTHON_ADD_MODULE _NAME )
OPTION(PYTHON_ENABLE_MODULE_${_NAME} "Add module ${_NAME}" TRUE)
+ OPTION(PYTHON_MODULE_${_NAME}_BUILD_SHARED "Add module ${_NAME} shared" ${_TARGET_SUPPORTS_SHARED_LIBS})
IF(PYTHON_ENABLE_MODULE_${_NAME})
- OPTION(PYTHON_MODULE_${_NAME}_SHARED "Add module ${_NAME} shared" FALSE)
- IF(PYTHON_MODULE_${_NAME}_SHARED)
+ IF(PYTHON_MODULE_${_NAME}_BUILD_SHARED)
SET(PY_MODULE_TYPE MODULE)
- ELSE(PYTHON_MODULE_${_NAME}_SHARED)
+ ELSE(PYTHON_MODULE_${_NAME}_BUILD_SHARED)
SET(PY_MODULE_TYPE STATIC)
SET(PY_STATIC_MODULES_LIST ${PY_STATIC_MODULES_LIST} ${_NAME} CACHE STRING "Collect a list of all added static python modules" FORCE)
- ENDIF(PYTHON_MODULE_${_NAME}_SHARED)
+ ENDIF(PYTHON_MODULE_${_NAME}_BUILD_SHARED)
SET(PY_MODULES_LIST ${PY_MODULES_LIST} ${_NAME} CACHE STRING "Collect a list of all added python modules" FORCE)
ADD_LIBRARY(${_NAME} ${PY_MODULE_TYPE} ${ARGN})
@@ -120,13 +122,13 @@ MACRO(PYTHON_WRITE_MODULES_HEADER _filename)
FILE(APPEND ${_filename} "#define ${_name}\n\n")
FILE(APPEND ${_filename} "#include <Python.h>\n\n")
- FOREACH(_currentModule ${PY_MODULES_LIST})
+ FOREACH(_currentModule ${PY_STATIC_MODULES_LIST})
FILE(APPEND ${_filename} "extern void init${_currentModule}(void);\n\n")
- ENDFOREACH(_currentModule ${PY_MODULES_LIST})
+ ENDFOREACH(_currentModule ${PY_STATIC_MODULES_LIST})
- FOREACH(_currentModule ${PY_MODULES_LIST})
+ FOREACH(_currentModule ${PY_STATIC_MODULES_LIST})
FILE(APPEND ${_filename} "int CMakeLoadPythonModule_${_currentModule}(void) \n{\n return PyImport_AppendInittab(\"${_currentModule}\", init${_currentModule});\n}\n\n")
- ENDFOREACH(_currentModule ${PY_MODULES_LIST})
+ ENDFOREACH(_currentModule ${PY_STATIC_MODULES_LIST})
FILE(APPEND ${_filename} "#ifndef EXCLUDE_LOAD_ALL_FUNCTION\nvoid CMakeLoadAllPythonModules(void)\n{\n")
FOREACH(_currentModule ${PY_STATIC_MODULES_LIST})