function(add_opt_game DIR GAME_NAME)
  add_definitions(-D${GAME_NAME})
  add_subdirectory(games/${DIR})
  get_directory_property(${GAME_NAME}_DEP_LIBS
    DIRECTORY games/${DIR}
    DEFINITION DEP_LIBS)
  set(DEP_LIBS ${DEP_LIBS} ${${GAME_NAME}_DEP_LIBS} PARENT_SCOPE)
  set(OBJECT_LIBS_LIST ${OBJECT_LIBS_LIST} $<TARGET_OBJECTS:${DIR}> PARENT_SCOPE)
  if(NOT OPENCV_FOUND)
    add_dependencies(${DIR} opencv)
  endif()
endfunction()

if (WITH_ATARI)
  message("Info: Atari is added.")
  add_opt_game(arcade ATARI)
else()
  message("Warning: Atari is not added.")
endif()

if (WITH_XWORLD3D)
  message("Info: XWorld3D is added.")
  add_opt_game(xworld3d XWORLD3D)
else()
  message("Warning: XWorld3D is not added.")
endif()
