#===============================================================================
# 

# Check the CMake version
CMAKE_MINIMUM_REQUIRED( VERSION 2.4 )
IF( COMMAND cmake_policy )
  CMAKE_POLICY( SET CMP0003 NEW )
ENDIF( COMMAND cmake_policy )

# Main project name
PROJECT( VctlModules )

# Set default build type
IF( NOT MSVC )
  IF( NOT CMAKE_BUILD_TYPE )
    SET( CMAKE_BUILD_TYPE Release CACHE STRING 
         "Choose the type of build, options are: Release and Debug." FORCE )
  ENDIF( NOT CMAKE_BUILD_TYPE )
ENDIF( NOT MSVC )

# Set platform specific definitions
IF( WIN32 )
  # nothing special...
ELSE( WIN32 )
  MESSAGE( FATAL_ERROR "Sorry, only the win32 platform is supported!" )
ENDIF( WIN32 )

# Set output path for libraries
SET( LIBRARY_OUTPUT_PATH ${VctlModules_BINARY_DIR}/lib CACHE PATH "Output directory for libraries." )

# Set output path for binaries
# SET( EXECUTABLE_OUTPUT_PATH ${VctlModules_BINARY_DIR}/bin CACHE PATH "Output directory for executables." )
SET( EXECUTABLE_OUTPUT_PATH ${VctlModules_BINARY_DIR} CACHE PATH "Output directory for executables." )
SET( MDSTK_LIBRARY_PATH CACHE PATH "Path to directory with MDSTk libraries." )
SET( MDSTK_INCLUDE_PATH CACHE PATH "Path to directory with MDSTk includes." )
SET( CMAKE_INSTALL_PREFIX ${PROJECT_SOURCE_DIR}/install CACHE PATH "Project installation path." )

# Set LINK and INCLUDE directory for MDSTk
LINK_DIRECTORIES( ${MDSTK_LIBRARY_PATH} )
INCLUDE_DIRECTORIES( ${MDSTK_INCLUDE_PATH} ${PROJECT_SOURCE_DIR}/include )

# Add compilation target for MDSTk
ADD_DEFINITIONS( -DMDS_LIBRARY_STATIC )

# Set MDSTk import library
SET( VCTLMODULES_LINK_LIBRARIES debug ModuleDbg
                                debug ImageIODbg 
                                debug ImageDbg 
                                debug BaseDbg 
                                debug MathDbg 
                                debug SystemDbg 
                                debug VectorEntityDbg 
                                debug TinyXMLDbg
                                optimized Module
                                optimized ImageIO 
                                optimized Image 
                                optimized Base 
                                optimized Math 
                                optimized System 
                                optimized VectorEntity 
                                optimized TinyXML 
                                general zlib )

# Continue with subdirectories
ADD_SUBDIRECTORY( src )

