# Copyright © 2016 Canonical Ltd.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 3 as
# published by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
#
# Authored by: Gary Wang <gary.wang@canonical.com>

cmake_minimum_required(VERSION 2.8)

project(mcloud)

set(MCLOUD_SOVERSION 0 CACHE STRING "The version number from libmcloud's SONAME")

include(GNUInstallDirs)

find_package(Threads)

set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror -Wall -pedantic -Wextra -fvisibility=hidden")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Werror -Wall -fno-strict-aliasing -fvisibility=hidden -fvisibility-inlines-hidden -pedantic -Wextra")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--no-undefined")

set(MCLOUD_LIB_VERSION_MAJOR 1)
set(MCLOUD_LIB_VERSION_MINOR 0)
set(MCLOUD_LIB_VERSION_PATCH 0)

include(CTest)

include_directories(
  include/
)

file(GLOB_RECURSE MCLOUD_LIB_INTERFACE_HEADERS include/*.h)

include(EnableCoverageReport)

add_subdirectory(doc)
add_subdirectory(data)
add_subdirectory(include)
add_subdirectory(src)
add_subdirectory(provider)
add_subdirectory(tests)

enable_coverage_report(
    TARGETS
        mcloud
        mcloud-provider
    FILTER
        ${CMAKE_SOURCE_DIR}/tests/*
        ${CMAKE_BINARY_DIR}/*
    TESTS
        ${UNIT_TEST_TARGETS}
)
