# *******************************************************************************
# * CMakeList.txt - docs CMake build file
# *
# * ScaleOut NamedCache C++ API Library
# *
# * Copyright (c) 2013-2016 by ScaleOut Software, Inc.
# *
# * Licensed under the Apache License, Version 2.0 (the "License");
# * you may not use this file except in compliance with the License.
# * You may obtain a copy of the License at
# *
# * http://www.apache.org/licenses/LICENSE-2.0
# *
# * Unless required by applicable law or agreed to in writing, software
# * distributed under the License is distributed on an "AS IS" BASIS,
# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# * See the License for the specific language governing permissions and
# * limitations under the License.
# *******************************************************************************

# Define minimum CMake version
cmake_minimum_required(VERSION 2.6)

# Include directories specified at top-level

set(CURRENT_TARGET_NAME             docs)

option(SOSS_BUILD_DOCS              "Generate API documentation." OFF)
option(SOSS_INCLUDE_INTERNAL_DOCS   "Generate API documentation for internal classes." OFF)
MARK_AS_ADVANCED(SOSS_INCLUDE_INTERNAL_DOCS)

if(SOSS_BUILD_DOCS)

	set(SOSS_DOCS_INPUT_DIR         ${SOSS_CLIENT_INCLUDE_DIR})
	set(SOSS_DOCS_EXCLUDE_FILES     "${SOSS_CLIENT_SRC_DIR}/include/sha2.h")
	if(NOT SOSS_INCLUDE_INTERNAL_DOCS)
		set(SOSS_DOCS_EXCLUDE_DIRS  "${SOSS_CLIENT_INCLUDE_DIR}/soss_client/internal")
	else(NOT SOSS_INCLUDE_INTERNAL_DOCS)
		message(WARNING "Building internal API documentation - this is NOT for release!")
	endif(NOT SOSS_INCLUDE_INTERNAL_DOCS)

	# Add target to generate API documentation with Doxygen
	find_package(Doxygen REQUIRED)
	configure_file(${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.in ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile @ONLY)
	add_custom_target(${CURRENT_TARGET_NAME} ALL
		${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile
		WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
		COMMENT "Generating API documentation with Doxygen" VERBATIM
	)

endif(SOSS_BUILD_DOCS)