ENH: make the list of modules global

Alex
This commit is contained in:
Alexander Neundorf 2007-07-19 11:47:23 -04:00
parent 8c77fe55dc
commit f0b6f02746
1 changed files with 10 additions and 2 deletions

View File

@ -85,6 +85,14 @@ SET(PYTHON_DEBUG_LIBRARIES "${PYTHON_DEBUG_LIBRARY}")
INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(PythonLibs PYTHON_LIBRARIES PYTHON_INCLUDE_PATH)
GET_TARGET_PROPERTIES(_FIND_PYTHONLIBS_ALREADY_INCLUDED __FindPythonLibsHelper TYPE)
IF(NOT _FIND_PYTHONLIBS_ALREADY_INCLUDED)
ADD_CUSTOM_TARGET(__FindPythonLibsHelper) # so if this file is included several times the next time GET_TARGET_PROPERTIES() will work
SET(PY_STATIC_MODULES_LIST "" CACHE STRING "Collect a list of all added static python modules" FORCE)
SET(PY_MODULES_LIST "" CACHE STRING "Collect a list of all added python modules" FORCE)
ENDIF(NOT _FIND_PYTHONLIBS_ALREADY_INCLUDED)
MACRO(PYTHON_ADD_MODULE _NAME )
OPTION(PYTHON_ENABLE_MODULE_${_NAME} "Add module ${_NAME}" TRUE)
@ -94,10 +102,10 @@ MACRO(PYTHON_ADD_MODULE _NAME )
SET(PY_MODULE_TYPE MODULE)
ELSE(PYTHON_MODULE_${_NAME}_SHARED)
SET(PY_MODULE_TYPE STATIC)
SET(PY_STATIC_MODULES_LIST ${PY_STATIC_MODULES_LIST} ${_NAME})
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)
SET(PY_MODULES_LIST ${PY_MODULES_LIST} ${_NAME})
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})
# TARGET_LINK_LIBRARIES(${_NAME} ${PYTHON_LIBRARIES})
ENDIF(PYTHON_ENABLE_MODULE_${_NAME})