PROJECT(SuperMatrix)

cmake_minimum_required(VERSION 2.6)

IF(NOT CMAKE_BUILD_TYPE)
	SET(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING
		"Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel."
	FORCE)
ENDIF(NOT CMAKE_BUILD_TYPE)


if(CMAKE_COMPILER_IS_GNUCXX)
	set(CMAKE_C_FLAGS "-Wall $ENV{CFLAGS}"  CACHE STRING "Flags used by the C compiler." FORCE)
	set(CMAKE_CXX_FLAGS "-Wall $ENV{CXXFLAGS}" CACHE STRING "Flags used by the CXX compiler." FORCE)
	set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O2 -g -fno-omit-frame-pointer" 
		CACHE STRING "Flags used by the CXX compiler during RelWithDebInfo builds" FORCE)
endif(CMAKE_COMPILER_IS_GNUCXX)

set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/CMakeScripts)

FIND_PACKAGE(Boost )
Find_Package(MPI)
Find_package(Corpus)
Find_package(SWIG)
Find_package(Corpus2)
Find_package(MYSQL++)
Find_package(Log4cxx)
Find_package(PoliqarpReader)

if(NOT LOG4CXX_FOUND)
MESSAGE(FATAL_ERROR "Log4cxx not found!")
endif(NOT LOG4CXX_FOUND)

if(NOT Boost_FOUND)
MESSAGE(FATAL_ERROR "Boost not found!")
endif(NOT Boost_FOUND)

include_directories(
${Boost_INCLUDE_DIR}
  )

if(UNIX)
add_definitions(-DLINUX)
endif(UNIX)

add_subdirectory(matrices)
add_subdirectory(comparator)

if(CORPUS_FOUND)
#	add_subdirectory(LexicalUnits)
endif(CORPUS_FOUND)

add_subdirectory(clustering)
add_subdirectory(tools)

if(SWIG_FOUND)
	add_subdirectory(swig_wrap)
endif(SWIG_FOUND)


IF(MPI_FOUND)
	add_subdirectory(parallel)
endif(MPI_FOUND)

add_subdirectory(unit_tests)



