cmake_minimum_required(VERSION 2.6)

PROJECT(sample)

SET (USE_NAVLITE 0)

#set the default path for built executables to the "bin" directory
set(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/bin)
#set the default path for built libraries to the "lib" directory
set(LIBRARY_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/lib)

# Tell cmake where to find local FIND_PACKAGE files
SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/")

# define some useful macros (located in cmake/Modules/)
INCLUDE(cmake/Modules/myMacros.cmake)

# Add some compiler flags
ADD_DEFINITIONS(-g -Wall) # all warnings
#ADD_DEFINITIONS(-g -w) # no warnings

# Operating system-specific flags
IF (CMAKE_SYSTEM_NAME STREQUAL "Darwin")
    ADD_DEFINITIONS(-DMACOSX)
ENDIF (CMAKE_SYSTEM_NAME STREQUAL "Darwin")

#ADD_DEFINITIONS(-DVOBJ_TALKER_OLD)
ADD_DEFINITIONS(-DVOBJ_TALKER_NEW)

# Where are the external libs and include files?
INCLUDE_DIRECTORIES(/opt/local/include)
INCLUDE_DIRECTORIES(/usr/local/include)
INCLUDE_DIRECTORIES(/usr/include)
INCLUDE_DIRECTORIES(/sw/include)

LINK_DIRECTORIES(/opt/local/lib)
LINK_DIRECTORIES(/usr/local/lib)
LINK_DIRECTORIES(/usr/lib)
LINK_DIRECTORIES(/sw/lib)

# Tell cmake where to look for the project (local) include files
# associated with other modules
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/src)

# Tell cmake where to look for the locally generated libraries
LINK_DIRECTORIES(${CMAKE_SOURCE_DIR}/lib)

# add the modules
IF (USE_NAVLITE)
   SET(modules	skynet viewer rrt-planner nav-utils)
ELSE (USE_NAVLITE)
   SET(modules	rrt-planner)
ENDIF (USE_NAVLITE)

# compile the code
FOREACH(module ${modules})
	       ADD_SUBDIRECTORY(${CMAKE_SOURCE_DIR}/src/${module}/ ${CMAKE_BINARY_DIR}/bin/${module}) # (<src-dir> <bin-dir>)
ENDFOREACH(module)
