# Root CMakeLists.txt file
#
# Project: fileManagement
# Author: G. Le Mahec (gael.le.mahec@sysfera.fr)
# Date: Nov. 4th 2009

cmake_minimum_required(VERSION 2.6)
project(fileManagement)
set(CMAKE_MODULE_PATH ${fileManagement_SOURCE_DIR}/Cmake)

set(CFG_FILE  "/etc/DIET/diet-fmd.cfg" CACHE PATH "Path to the DIET File Manager Daemon configuration file")
option(DEV_LIB   "Create the developper library" OFF)
if (DEV_LIB)
  option(DEBUG_LIB "Activate debug message when using API" OFF)
endif (DEV_LIB)
if (DEBUG_LIB)
  add_definitions(-DDEBUG_DEV_LIB)
endif (DEBUG_LIB)

if (APPLE)
  add_definitions(-DBSD_LIKE_SYSTEM)
endif (APPLE)

add_definitions(-DHAVE_DAGDA)
add_definitions(-DFMD_CONFIG_FILE="${CFG_FILE}")

exec_program(uname ARGS -p OUTPUT_VARIABLE SYS_ARCH)
if (NOT ${SYS_ARCH} STREQUAL "i386")
#  add_definitions(-mlittle-endian)
endif (NOT ${SYS_ARCH} STREQUAL "i386")

find_package(DIET)
if (DIET_FOUND)
else (DIET_FOUND)
  message("DIET installation was not found. Define the DIET_DIR variable to continue.")
  message("	- You can define a DIET_DIR environment variable")
  message("	- You can pass it as argument to cmake:")
  message("	  $ cmake <source root directory> -DDIET_DIR:PATH=/path/to/DIET")
  message("	- You can use the ccmake GUI")
  set(DIET_DIR "" cache path "DIET installation path")
endif(DIET_FOUND)

add_subdirectory(src)
add_subdirectory(man)
