# *******************************************************************************
# * CMakeList.txt - main 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)

# Define the project name
# This is how it will be called in Visual Studio and other Makefiles
project(NativeClient)

# Project version
set(SOSS_VERSION_MAJOR              5)
set(SOSS_VERSION_MINOR              2)

# Configure Visual Studio to use "multiple process" compilation to greatly speed up compile time
if(MSVC)
	add_definitions( /MP )
endif(MSVC)


# Setup project directories
# =============================================================================
set(ROOT_DIR                        "${CMAKE_SOURCE_DIR}")

# Include the local modules directory
set(CMAKE_MODULE_PATH               "${ROOT_DIR}/CMakeModules")

# Top-level project directories (add new build targets to $BUILD_TARGETS below!)

# soss_client
set(SOSS_CLIENT_DIR                 "${ROOT_DIR}/soss_client")
set(SOSS_CLIENT_INCLUDE_DIR         "${ROOT_DIR}/include")
set(SOSS_CLIENT_SRC_DIR             "${ROOT_DIR}/src")

# Unit tests for soss_client
set(TEST_DIR                        "${ROOT_DIR}/tests")

# API documentation
set(DOCS_DIR                        "${ROOT_DIR}/docs")

set(BUILD_TARGETS
	"${SOSS_CLIENT_DIR}"
	"${TEST_DIR}"
	"${DOCS_DIR}"
)



# Build sub-projects
# =============================================================================

# Add each project subdirectory to the parent project
foreach(TARGET ${BUILD_TARGETS})
	if(EXISTS ${TARGET})
		add_subdirectory(${TARGET})
	else(EXISTS ${TARGET})
		message(FATAL_ERROR "${TARGET} specified as a build target, but ${CMAKE_SOURCE_DIR}/${TARGET} does not exist!")
	endif(EXISTS ${TARGET})
endforeach(TARGET)
