project(PLIBS_8)
cmake_minimum_required(VERSION 2.8)
#On cherche si doxygen est installé
find_package(Doxygen REQUIRED)

if(DOXYGEN_FOUND)
	message(STATUS "Find Doxygen at ${DOXYGEN_DIR}")
	#si vous allez voir dans le dossier build/doc, vous allez trouver le fichier Doxyfile
	configure_file(Doxyfile.cmake Doxyfile)
	#on exécute doxygen dans build pour ne pas avoir à nous déplacer pour faire le ménage après, ça évite de mettre html et man3 n'importe où
	exec_program(${DOXYGEN_EXECUTABLE}
		"${CMAKE_CURRENT_BINARY_DIR}"
		ARGS "${CMAKE_CURRENT_BINARY_DIR}/Doxyfile"
	)
	configure_file(index.html.cmake index.html)

	install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/html DESTINATION share/PLIBS_8/doc)
	#Comme il faut des droits d'administrateur pour installer le man dans /usr/share/man, je préfère le mettre dans le dossier doc
	#mais on pourait installer la doc où il faut en RELEASE_MODE=yes
	install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/man DESTINATION share/PLIBS_8/doc)

	set(docDeBase ${CMAKE_CURRENT_BINARY_DIR}/index.html style.css)

	install(FILES ${docDeBase} DESTINATION share/PLIBS_8/doc)

else (DOXYGEN_FOUND)
	message(STATUS "Doxygen not found, I cannot generate the documentation")
endif (DOXYGEN_FOUND)



