# Copyright (c) Lawrence Livermore National Security, LLC and other Conduit
# Project developers. See top-level LICENSE AND COPYRIGHT files for dates and
# other details. No copyright assignment is required to contribute to Conduit.

###############################################################################
# Note:
# This file is named ConduitConfig.cmake because once upon a time
# when it was named conduit-config.cmake, we found that CMake's exported
# targets script includes all "ascent-*.cmake" files. This logic would
# cause this script to be included more than once, seeding instability
# that caused great harm to the kingdom.
###############################################################################


cmake_minimum_required(VERSION 3.0 FATAL_ERROR)

@PACKAGE_INIT@

if(NOT CONDUIT_FOUND)

    # Compute the installation prefix relative to this file.
    get_filename_component(_IMPORT_PREFIX "${CMAKE_CURRENT_LIST_FILE}" PATH)
    get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH)
    get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH)
    if(_IMPORT_PREFIX STREQUAL "/")
      set(_IMPORT_PREFIX "")
    endif()

    set(CONDUIT_VERSION "@PROJECT_VERSION@")
    set(CONDUIT_USE_CXX11 "@CONDUIT_USE_CXX11@")
    set(CONDUIT_USE_FMT   "@CONDUIT_USE_FMT@")
    set(CONDUIT_USE_CALIPER "@CONDUIT_USE_CALIPER@")
    set(CONDUIT_INSTALL_PREFIX "@CONDUIT_INSTALL_PREFIX@")
    set(CONDUIT_PYTHON_MODULE_DIR "@CONDUIT_INSTALL_PYTHON_MODULE_DIR@")
    set(CONDUIT_HDF5_DIR  "@HDF5_DIR@")
    set(CONDUIT_ADIOS_DIR "@ADIOS_DIR@")
    set(CONDUIT_SILO_DIR "@SILO_DIR@")
    set(CONDUIT_METIS_DIR "@METIS_DIR@")
    set(CONDUIT_PARMETIS_DIR "@PARMETIS_DIR@")
    set(CONDUIT_ADIAK_DIR "@ADIAK_DIR@")
    set(CONDUIT_CALIPER_DIR "@CALIPER_DIR@")
    set(CONDUIT_PYTHON_ENABLED "@PYTHON_FOUND@")
    set(CONDUIT_PYTHON_EXECUTABLE "@PYTHON_EXECUTABLE@")
    set(CONDUIT_PYTHON_MODULE_DIR "@CONDUIT_INSTALL_PYTHON_MODULE_DIR@")
    set(CONDUIT_USE_CMAKE_MPI_TARGETS   "@CONDUIT_USE_CMAKE_MPI_TARGETS@")

    get_filename_component(CONDUIT_CMAKE_CONFIG_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH)

    # setup dependent pkgs
    include(${CONDUIT_CMAKE_CONFIG_DIR}/conduit_setup_deps.cmake)

    # include targets exported by cmake
    include(${CONDUIT_CMAKE_CONFIG_DIR}/conduit.cmake)

    # finally setup our final imported targets
    include(${CONDUIT_CMAKE_CONFIG_DIR}/conduit_setup_targets.cmake)

    set(CONDUIT_FOUND TRUE)

endif()

