project(Cauchy)

cmake_minimum_required(VERSION 2.6)

set(LIB_SUFFIX "" CACHE STRING "Define suffix of directory name (32/64)" )

option(CAUCHY_ENABLE_DEBUG_OUTPUT "Enable (heavy) debug output (only do that for debugging Cauchy" OFF)
option(CAUCHY_BUILD_TESTS "Build tests" OFF)
option(CAUCHY_FULL_WARNINGS "Build OpenGTL with all warnings" OFF)

set(CAUCHY_VERSION "0.9.13")
set(CAUCHY_LIB_VERSION ${CAUCHY_VERSION})
set(CAUCHY_LIB_SOVERSION "0.0")

set(LIB_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX}/)
set(INCLUDE_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/include/)
set(BIN_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/bin/)
set(SHARE_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/share/Cauchy/)

set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/modules )
find_package(Eigen3 REQUIRED)

#
# Define INSTALL_TARGETS_DEFAULT_ARGS to be used as install target for program and library. It will do the right thing on all platform
#
set(INSTALL_TARGETS_DEFAULT_ARGS  RUNTIME DESTINATION "${BIN_INSTALL_DIR}"
                                  LIBRARY DESTINATION "${LIB_INSTALL_DIR}"
                                  ARCHIVE DESTINATION "${LIB_INSTALL_DIR}" COMPONENT Devel )

if(CAUCHY_ENABLE_DEBUG_OUTPUT)
  add_definitions(-DCAUCHY_ENABLE_DEBUG_OUTPUT)
endif()

if(CAUCHY_BUILD_TESTS)
  include(CTest)
  add_definitions(-DCAUCHY_ENABLE_TESTS)
endif()

if(CAUCHY_FULL_WARNINGS)
  set(CAUCHY_BUILD_DEFINITION "-Wall -Werror -Woverloaded-virtual -Wno-pmf-conversions -Wsign-promo -Wextra")
  add_definitions( ${CAUCHY_BUILD_DEFINITION} )
endif()

include_directories( ${CMAKE_SOURCE_DIR} ${EIGEN3_INCLUDE_DIR})

set(CAUCHYMC "${CMAKE_CURRENT_BINARY_DIR}/tools/cauchymc/cauchymc")

add_subdirectory(Cauchy)
if(CAUCHY_BUILD_TESTS)
  add_subdirectory(CauchyTest)
  add_subdirectory(tests)
endif()
add_subdirectory(tools)
add_subdirectory(Runtime)
