#--------------------------------------------
#
#      CamiTK Community Edition CEP Set
#
#--------------------------------------------
cmake_minimum_required(VERSION 3.0)

project(camitkcommunityedition)

# Allow testing of the whole camitk-communityedition project
include(CTest)
enable_testing()

set(CAMITK_PROJECT_NAME "CamiTK")
# The current version of CamiTK is defined in a separate file to avoid conflict/problem when merging
include(CamiTKVersion.cmake)
string(TOLOWER "${CAMITK_PROJECT_NAME}-${CAMITK_VERSION_MAJOR}.${CAMITK_VERSION_MINOR}" CAMITK_SHORT_VERSION_STRING)

# Specific to the Community Edition: this is the Community Edition build
set(CAMITK_COMMUNITY_EDITION_BUILD TRUE)

#-- This is a CEP set...
set(CAMITK_EXTENSION_PROJECT_SET TRUE CACHE BOOL "Is this a CamiTK Extension Project Set?")
set(CAMITK_EXTENSION_PROJECT_SET_NAME "camitk-communityedition" CACHE STRING "CEP Set Name")

# Configure CamiTK Community Edition packaging.
# Must be done before parsing extensions CMakeLists.txt files.
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/sdk/cmake/modules/macros ${CMAKE_CURRENT_SOURCE_DIR}/sdk/cmake/modules)
set(CAMITK_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
include(camitk/packaging/CamiTKCommunityEditionPackaging)
camitk_communityedition_packaging()

# Configure include-what-you-use to check the current target
include(camitk/test/CamiTKIncludeWhatYouUse)

# CamiTK requires C++11
if(${CMAKE_VERSION} VERSION_LESS "3.1.3")
    # On MSVC C++11 is the default
    if(UNIX)
        # CMAKE_CXX_STANDARD not available for cmake 3.0.2 (as in debian old stable)
        set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
    endif()
else()
    # All target after this declaration will be compile with c++11 policy
    set(CMAKE_CXX_STANDARD 11)
endif()

# Specific to SDK: first compile the SDK (it looks like a CEP but is sooooo special...)
add_subdirectory(sdk)

# ...composed by the following CamiTK Extension Projects (optional)
add_subdirectory(imaging)
add_subdirectory(modeling)

# ... and tutorials that helps understand CamiTK (optional)
add_subdirectory(tutorials)


# Do we wrapp CamiTK for scripting it into Python using Shiboken and PySide ?
set(CAMITK_BINDING_PYTHON CACHE BOOL FALSE)

# Consider python binding only if the CMake variable is checked
if(CAMITK_BINDING_PYTHON)
    add_subdirectory(python_sdk)
endif()


camitk_write_manifest_data(CEP_SET)
