+function (_PYTHON_MARK_AS_INTERNAL)
+ foreach (var IN LISTS ARGV)
+ if (DEFINED CACHE{${var}})
+ set_property (CACHE ${var} PROPERTY TYPE INTERNAL)
+ endif()
+ endforeach()
+endfunction()
+
+
+macro (_PYTHON_SELECT_LIBRARY_CONFIGURATIONS _PYTHON_BASENAME)
+ if(NOT DEFINED ${_PYTHON_BASENAME}_LIBRARY_RELEASE)
+ set(${_PYTHON_BASENAME}_LIBRARY_RELEASE "${_PYTHON_BASENAME}_LIBRARY_RELEASE-NOTFOUND")
+ endif()
+ if(NOT DEFINED ${_PYTHON_BASENAME}_LIBRARY_DEBUG)
+ set(${_PYTHON_BASENAME}_LIBRARY_DEBUG "${_PYTHON_BASENAME}_LIBRARY_DEBUG-NOTFOUND")
+ endif()
+
+ get_property(_PYTHON_isMultiConfig GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
+ if (${_PYTHON_BASENAME}_LIBRARY_DEBUG AND ${_PYTHON_BASENAME}_LIBRARY_RELEASE AND
+ NOT ${_PYTHON_BASENAME}_LIBRARY_DEBUG STREQUAL ${_PYTHON_BASENAME}_LIBRARY_RELEASE AND
+ (_PYTHON_isMultiConfig OR CMAKE_BUILD_TYPE))
+ # if the generator is multi-config or if CMAKE_BUILD_TYPE is set for
+ # single-config generators, set optimized and debug libraries
+ set (${_PYTHON_BASENAME}_LIBRARY "")
+ foreach (_PYTHON_libname IN LISTS ${_PYTHON_BASENAME}_LIBRARY_RELEASE )
+ list( APPEND ${_PYTHON_BASENAME}_LIBRARY optimized "${_PYTHON_libname}" )
+ endforeach()
+ foreach (_PYTHON_libname IN LISTS ${_PYTHON_BASENAME}_LIBRARY_DEBUG )
+ list( APPEND ${_PYTHON_BASENAME}_LIBRARY debug "${_PYTHON_libname}" )
+ endforeach()
+ elseif (${_PYTHON_BASENAME}_LIBRARY_RELEASE)
+ set (${_PYTHON_BASENAME}_LIBRARY "${${_PYTHON_BASENAME}_LIBRARY_RELEASE}")
+ elseif (${_PYTHON_BASENAME}_LIBRARY_DEBUG)
+ set (${_PYTHON_BASENAME}_LIBRARY "${${_PYTHON_BASENAME}_LIBRARY_DEBUG}")
+ else()
+ set (${_PYTHON_BASENAME}_LIBRARY "${_PYTHON_BASENAME}_LIBRARY-NOTFOUND")
+ endif()
+
+ set (${_PYTHON_BASENAME}_LIBRARIES "${${_PYTHON_BASENAME}_LIBRARY}")
+endmacro()
+
+