if ( NOT DEFINED ENABLE_SWIG_PYTHON3 OR ENABLE_SWIG_PYTHON3 )
  if(NOT PYTHON3_VERSION)
    set(PYTHON3_VERSION 3.4)
  endif(NOT PYTHON3_VERSION)
  if ( PYTHON3_EXECUTABLE )
    set( PYTHON_EXECUTABLE ${PYTHON3_EXECUTABLE} )
  endif ( PYTHON3_EXECUTABLE )

  #======================================================================
  # Find python
  #======================================================================
  cx_python(
    PREFIX PYTHON3
    VERSION ${PYTHON3_VERSION} )

  if (PYTHON3LIBS_FOUND)
    #----------------------------------------------------------------------
    # All pieces needed have been found
    #----------------------------------------------------------------------
    set( ENABLE_SWIG_PYTHON3 "yes"
      CACHE INTERNAL "Enable building of SWIG bindings for Python 3" )
    message(STATUS "Generating Python ${PYTHON_VERSION_STRING} extensions for ${PROJECT_NAME}")
    execute_process(
      COMMAND ${CMAKE_COMMAND} -E touch ${CMAKE_CURRENT_BINARY_DIR}/__init__.py
      OUTPUT_QUIET
      ERROR_QUIET
      )

    install(
      FILES ${CMAKE_CURRENT_BINARY_DIR}/__init__.py
      DESTINATION "${PYTHON${PYTHON3_VERSION_MAJOR}${PYTHON3_VERSION_MINOR}_MODULE_INSTALL_DIR}/LDAStools"
      COMPONENT Python
      )

  else( )
    #----------------------------------------------------------------------
    # All pieces needed have NOT been found
    #----------------------------------------------------------------------
    message(STATUS "Not generating Python 3 extensions for ${PROJECT_NAME}")
  endif( )

endif ( NOT DEFINED ENABLE_SWIG_PYTHON3 OR ENABLE_SWIG_PYTHON3 )
