# @HEADER
# ************************************************************************
#
#            TriBITS: Tribal Build, Integrate, and Test System
#                    Copyright 2013 Sandia Corporation
#
#
# Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
# the U.S. Government retains certain rights in this software.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
#
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# 3. Neither the name of the Corporation nor the names of the
# contributors may be used to endorse or promote products derived from
# this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
# ************************************************************************
# @HEADER

##############################################################################
#
# CMake variable for use by ${PROJECT_NAME}/${PACKAGE_NAME} clients.
#
# ${DISCOURAGE_EDITING}
#
##############################################################################

${DEFINE_CMAKE_CURRENT_LIST_DIR_CODE_SNIPPET}

## ---------------------------------------------------------------------------
## Compilers used by ${PROJECT_NAME}/${PACKAGE_NAME} build
## ---------------------------------------------------------------------------

set(${EXPORT_FILE_VAR_PREFIX}_CXX_COMPILER "${CMAKE_CXX_COMPILER_FOR_CONFIG_FILE}")

set(${EXPORT_FILE_VAR_PREFIX}_C_COMPILER "${CMAKE_C_COMPILER_FOR_CONFIG_FILE}")

set(${EXPORT_FILE_VAR_PREFIX}_Fortran_COMPILER "${CMAKE_Fortran_COMPILER_FOR_CONFIG_FILE}")
# Deprecated!
set(${EXPORT_FILE_VAR_PREFIX}_FORTRAN_COMPILER "${CMAKE_Fortran_COMPILER_FOR_CONFIG_FILE}") 


## ---------------------------------------------------------------------------
## Compiler flags used by ${PROJECT_NAME}/${PACKAGE_NAME} build
## ---------------------------------------------------------------------------

## Give the build type
set(${EXPORT_FILE_VAR_PREFIX}_CMAKE_BUILD_TYPE "${CMAKE_BUILD_TYPE}")

## Set compiler flags, including those determined by build type
set(${EXPORT_FILE_VAR_PREFIX}_CXX_FLAGS [[${CMAKE_CXX_FLAGS_ESCAPED} ${CMAKE_CXX_FLAGS_${CMAKE_BUILD_TYPE}}]])

set(${EXPORT_FILE_VAR_PREFIX}_C_FLAGS [[${CMAKE_C_FLAGS} ${CMAKE_C_FLAGS_${CMAKE_BUILD_TYPE}}]])

set(${EXPORT_FILE_VAR_PREFIX}_Fortran_FLAGS [[${CMAKE_FORTRAN_FLAGS} ${CMAKE_Fortran_FLAGS_${CMAKE_BUILD_TYPE}}]])
# Deprecated
set(${EXPORT_FILE_VAR_PREFIX}_FORTRAN_FLAGS [[${CMAKE_FORTRAN_FLAGS} ${CMAKE_Fortran_FLAGS_${CMAKE_BUILD_TYPE}}]])

## Extra link flags (e.g., specification of fortran libraries)
set(${EXPORT_FILE_VAR_PREFIX}_EXTRA_LD_FLAGS [[${${PROJECT_NAME}_EXTRA_LINK_FLAGS}]])

## This is the command-line entry used for setting rpaths. In a build
## with static libraries it will be empty.
set(${EXPORT_FILE_VAR_PREFIX}_SHARED_LIB_RPATH_COMMAND "${SHARED_LIB_RPATH_COMMAND}")
set(${EXPORT_FILE_VAR_PREFIX}_BUILD_SHARED_LIBS "${BUILD_SHARED_LIBS}")

set(${EXPORT_FILE_VAR_PREFIX}_LINKER ${CMAKE_LINKER})
set(${EXPORT_FILE_VAR_PREFIX}_AR ${CMAKE_AR})

## ---------------------------------------------------------------------------
## Set library specifications and paths
## ---------------------------------------------------------------------------

## Base install location (if not in the build tree)
set(${EXPORT_FILE_VAR_PREFIX}_INSTALL_DIR "@CMAKE_INSTALL_PREFIX@")

## List of package include dirs
set(${EXPORT_FILE_VAR_PREFIX}_INCLUDE_DIRS "${FULL_INCLUDE_DIRS_SET}")

## List of package library paths
set(${EXPORT_FILE_VAR_PREFIX}_LIBRARY_DIRS "${FULL_LIBRARY_DIRS_SET}")

## List of package libraries
set(${EXPORT_FILE_VAR_PREFIX}_LIBRARIES "${FULL_LIBRARY_SET}")

## Specification of directories for TPL headers
set(${EXPORT_FILE_VAR_PREFIX}_TPL_INCLUDE_DIRS "${${PACKAGE_NAME}_TPL_INCLUDE_DIRS}")

## Specification of directories for TPL libraries
set(${EXPORT_FILE_VAR_PREFIX}_TPL_LIBRARY_DIRS "${${PACKAGE_NAME}_TPL_LIBRARY_DIRS}")

## List of required TPLs
set(${EXPORT_FILE_VAR_PREFIX}_TPL_LIBRARIES "${${PACKAGE_NAME}_TPL_LIBRARIES}")

## ---------------------------------------------------------------------------
## MPI specific variables
##   These variables are provided to make it easier to get the mpi libraries
##   and includes on systems that do not use the mpi wrappers for compiling
## ---------------------------------------------------------------------------

set(${EXPORT_FILE_VAR_PREFIX}_MPI_LIBRARIES "${TPL_MPI_LIBRARIES}")
set(${EXPORT_FILE_VAR_PREFIX}_MPI_LIBRARY_DIRS "${TPL_MPI_LIBRARY_DIRS}")
set(${EXPORT_FILE_VAR_PREFIX}_MPI_INCLUDE_DIRS "${TPL_MPI_INCLUDE_DIRS}")
set(${EXPORT_FILE_VAR_PREFIX}_MPI_EXEC "${MPI_EXEC}")
set(${EXPORT_FILE_VAR_PREFIX}_MPI_EXEC_MAX_NUMPROCS "${MPI_EXEC_MAX_NUMPROCS}")
set(${EXPORT_FILE_VAR_PREFIX}_MPI_EXEC_NUMPROCS_FLAG "${MPI_EXEC_NUMPROCS_FLAG}")

## ---------------------------------------------------------------------------
## Set useful general variables
## ---------------------------------------------------------------------------

## The packages enabled for this project
set(${EXPORT_FILE_VAR_PREFIX}_PACKAGE_LIST "${FULL_PACKAGE_SET}")

## The TPLs enabled for this project
set(${EXPORT_FILE_VAR_PREFIX}_TPL_LIST "${ORDERED_FULL_TPL_SET}")

${PACKAGE_CONFIG_CODE}
