FIND_PROGRAM(PYTHON_EXECUTABLE python)

IF(EXISTS ${PYTHON_EXECUTABLE}) 
	execute_process(COMMAND "${PYTHON_EXECUTABLE}" "-c"
			"import gensim"
			OUTPUT_VARIABLE NIC
			ERROR_VARIABLE STATUS
        		)
	STRING(REGEX MATCH ".*ImportError: No module named gensim.*"  ERR_CONTENT "${STATUS}")
	STRING(LENGTH "${ERR_CONTENT}" ERR)
	IF(${ERR} EQUAL 0)
		add_definitions(-DGENSIM="1")
		MESSAGE(STATUS "Found gensim")
	ELSE(${ERR} EQUAL 0)
		add_definitions(-DGENSIM="0")
		MESSAGE(WARNING "Could not find gensim")
	ENDIF(${ERR} EQUAL 0)
ELSE(EXISTS ${PYTHON_EXECUTABLE})
	add_definitions(-DGENSIM="0")
ENDIF(EXISTS ${PYTHON_EXECUTABLE})

