include(CheckIncludeFileCXX)
set(CHECK_INCLUDES "-include stdio.h")
if(WIN32)
	set(CHECK_INCLUDES "-include windows.h -include stdio.h")
endif()
set(_mkd_header_found 0)
check_include_file_cxx("mkdio.h" MARKDOWN_HEADER_MKDIO ${CHECK_INCLUDES})
if (MARKDOWN_HEADER_MKDIO OR APPLE)
	set(_mkd_header_found 1)
	add_definitions("-DMARKDOWN_HEADER=\"mkdio.h\"")
else()
	check_include_file_cxx("markdown/markdown.h" MARKDOWN_HEADER_MARKDOWN ${CHECK_INCLUDES})
	if (MARKDOWN_HEADER_MARKDOWN)
		set(_mkd_header_found 1)
		add_definitions("-DMARKDOWN_HEADER=\"markdown/markdown.h\"")
	endif()
endif()
find_library(MARKDOWN_LIBRARY markdown)
if (MARKDOWN_LIBRARY)
	qad_library(doc "Core" "${MARKDOWN_LIBRARY}")
	if(NOT _mkd_header_found)
		message(STATUS "Found markdown library, but *.h missing!")
		add_definitions("-DMARKDOWN_HEADER=\"markdown/markdown.h\"")
	endif()
else()
	add_definitions("-DNO_MARKDOWN")
	qad_library(doc "Core" "")
endif()
