CMAKE_MINIMUM_REQUIRED(VERSION 2.6)

CMAKE_POLICY(SET CMP0048 NEW)

LIST( APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/CMake )

INCLUDE_DIRECTORIES ( 
  ${CMAKE_CURRENT_BINARY_DIR}/include/rbdl
  )

SET_TARGET_PROPERTIES ( ${PROJECT_EXECUTABLES} PROPERTIES
  LINKER_LANGUAGE CXX
  )

# Perform the proper linking
SET (CMAKE_SKIP_BUILD_RPATH FALSE)
SET (CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)
SET (CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")
SET (CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)

# Options
SET ( BENCHMARK_SOURCES 
  model_generator.cc
  Human36Model.cc
  benchmark.cc
  )

ADD_EXECUTABLE ( benchmark ${BENCHMARK_SOURCES} )

IF (RBDL_BUILD_STATIC)
  SET (LIBRARIES rbdl-static)

  IF (RBDL_BUILD_ADDON_LUAMODEL) 
    SET (LIBRARIES ${LIBRARIES} rbdl_luamodel-static)
  ENDIF (RBDL_BUILD_ADDON_LUAMODEL) 

  IF (RBDL_BUILD_ADDON_URDFREADER) 
    SET (LIBRARIES ${LIBRARIES} rbdl_urdfreader-static)
  ENDIF (RBDL_BUILD_ADDON_URDFREADER) 

  TARGET_LINK_LIBRARIES ( benchmark
    rbdl-static
    ${LIBRARIES}
    )
ELSE (RBDL_BUILD_STATIC)
  SET (LIBRARIES rbdl)

  IF (RBDL_BUILD_ADDON_LUAMODEL) 
    SET (LIBRARIES ${LIBRARIES} rbdl_luamodel)
  ENDIF (RBDL_BUILD_ADDON_LUAMODEL) 

  IF (RBDL_BUILD_ADDON_URDFREADER) 
    SET (LIBRARIES ${LIBRARIES} rbdl_urdfreader)
  ENDIF (RBDL_BUILD_ADDON_URDFREADER) 

  TARGET_LINK_LIBRARIES ( benchmark
    rbdl
    ${LIBRARIES}
    )
ENDIF (RBDL_BUILD_STATIC)
