cmake_minimum_required(VERSION 3.20)

project(AdiosCatalyst LANGUAGES C CXX)

set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)

include (GNUInstallDirs)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_BINDIR}")
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}")

find_package(ADIOS2 REQUIRED)
find_package(catalyst REQUIRED)

# Always needed to be able to compile Adios2
find_package(MPI REQUIRED)

# Contains the current implementation
add_subdirectory(AdiosCatalyst)
add_subdirectory(AdiosReplay)

option(BUILD_TESTING "Build tests" OFF)
if(BUILD_TESTING)
  include(CTest)
  enable_testing()
endif()

# AdiosCatalyst's tests are end-to-end tests executed from the tests, they need the examples
option(BUILD_EXAMPLES "Build Examples" OFF)
if(BUILD_EXAMPLES OR BUILD_TESTING)
  add_subdirectory(Examples)
endif()
