# Copyright (c) 2007-2009 Hartmut Kaiser
# Copyright (c) 2011      Bryce Lelbach
#
# 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)

add_subdirectory(central_tuplespace)

set(examples
    simple_central_tuplespace
   )

set(simple_central_tuplespace_PARAMETERS THREADS_PER_LOCALITY 4)

# for all targets specified above
foreach(example ${examples})
  set(sources ${example}_client.cpp)

  source_group("Source Files" FILES ${sources})

  # add example executable
  add_hpx_executable(${example}_client
    SOURCES ${sources}
    COMPONENT_DEPENDENCIES ${example} iostreams
    FOLDER "Examples/TupleSpace/${example}")

  # add a custom target for this example
  add_hpx_pseudo_target(examples.tuplespace.${example})

  # make pseudo-targets depend on master pseudo-target
  add_hpx_pseudo_dependencies(examples.tuplespace
                              examples.tuplespace.${example})

  # add dependencies to pseudo-target
  add_hpx_pseudo_dependencies(examples.tuplespace.${example}
                              ${example}_client_exe)

  if(HPX_WITH_TESTS AND HPX_WITH_TESTS_EXAMPLES)
    add_hpx_example_test("tuplespace" ${example}_client ${${example}_PARAMETERS})
    add_hpx_pseudo_target(tests.examples.tuplespace.${example})
    add_hpx_pseudo_dependencies(tests.examples.tuplespace
                                tests.examples.tuplespace.${example})
    add_hpx_pseudo_dependencies(tests.examples.tuplespace.${example}
                                ${example}_client_exe)
  endif()
endforeach()
