# Copyright (c) 2023 ETH Zurich
#
# SPDX-License-Identifier: BSL-1.0
# 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)

set(example_programs hello_world_documentation init_hpp_documentation split_tuple_documentation
                     when_all_vector_documentation
)

foreach(example_program ${example_programs})
  set(sources ${example_program}.cpp)

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

  pika_add_executable(
    ${example_program} INTERNAL_FLAGS
    SOURCES ${sources} ${${example_program}_FLAGS}
    FOLDER "Examples/Documentation"
  )

  target_link_libraries(${example_program} PRIVATE ${${example_program}_LIBRARIES})
  pika_add_example_target_dependencies("documentation" ${example_program})

  if(PIKA_WITH_TESTS AND PIKA_WITH_TESTS_EXAMPLES)
    pika_add_example_test("documentation" ${example_program} ${${example_program}_PARAMETERS})
  endif()
endforeach()
