# Copyright (c) 2009 Maciej Brodowicz
#
# Distributed under the Boost Software License, Version 1.0. (See accompanying 
# file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)


### required cmake version
cmake_minimum_required(VERSION 2.6)


### actual project definitions
project(PowRTocH)

### common include dir
include_directories(include)

### external dependencies
# boost
find_package(Boost 1.41)
if(Boost_FOUND)
  message(STATUS "Boost " ${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION}
    " found in " ${Boost_INCLUDE_DIR} " and " ${Boost_LIBRARY_DIRS})
  #set(HAVE_BOOST ON CACHE BOOL "Platform supports multithreading")
  set(HAVE_BOOST 1)
else()
  message(FATAL "Boost installation has not been found.\n"
    "If Boost is installed in a non-standard location, please specify it as\n"
    "an argument to -DBOOST_ROOT=...")
endif()
include_directories(${Boost_INCLUDE_DIR})
link_directories(${Boost_LIBRARY_DIRS})

# flex
find_program(FLEX flex)
find_library(FLEXLIB fl)
if(FLEX-NOTFOUND OR FLEXLIB-NOTFOUND)
  message(FATAL_ERROR "flex does not seem to be supported on this platform")
endif()

# bison (yacc won't do)
find_program(BISON bison)
if(BISON-NOTFOUND)
  message(FATAL_ERROR "bison does not seem to be available on this platform")
endif()

### options
# if running on a system capable of talking to the meter(s)
option(HARDWARE_PRESENT "is the meter connected to the system we're compiling on?" OFF)

### source subdirs
add_subdirectory(comm)
#add_subdirectory(meterfs)
add_subdirectory(apps)
add_subdirectory(test)
