# v2rdm_casscfConfig.cmake
# -----------------------
#
# v2rdm_casscf cmake module.
# This module sets the following variables in your project::
#
#   v2rdm_casscf_FOUND - true if v2rdm_casscf and all required components found on the system
#   v2rdm_casscf_VERSION - v2rdm_casscf version in format Major.Minor.Release
#   v2rdm_casscf_LIBRARIES - v2rdm_casscf library to link against.
#   v2rdm_casscf_LIBRARY - same as LIBRARIES
#
#
# Available components: None
#
#
# Exported targets::
#
# If v2rdm_casscf is found, this module defines the following :prop_tgt:`IMPORTED`
# target. ::
#
#   v2rdm_casscf::v2rdm_casscf - the main v2rdm_casscf library
#
#
# Suggested usage::
#
#   find_package(v2rdm_casscf)
#   find_package(v2rdm_casscf 0.5 EXACT CONFIG REQUIRED)
#
#
# The following variables can be set to guide the search for this package::
#
#   v2rdm_casscf_DIR - CMake variable, set to directory containing this Config file
#   CMAKE_PREFIX_PATH - CMake variable, set to root directory of this package
##   PATH - environment variable, set to bin directory of this package
#   CMAKE_DISABLE_FIND_PACKAGE_v2rdm_casscf - CMake variable, disables
#     find_package(v2rdm_casscf) when not REQUIRED, perhaps to force internal build


####### Expanded from @PACKAGE_INIT@ by configure_package_config_file() #######
####### Any changes to this file will be overwritten by the next CMake run ####
####### The input file was v2rdm_casscfConfig.cmake.in                            ########

get_filename_component(PACKAGE_PREFIX_DIR "${CMAKE_CURRENT_LIST_DIR}/../../../" ABSOLUTE)

macro(set_and_check _var _file)
  set(${_var} "${_file}")
  if(NOT EXISTS "${_file}")
    message(FATAL_ERROR "File or directory ${_file} referenced by variable ${_var} does not exist !")
  endif()
endmacro()

macro(check_required_components _NAME)
  foreach(comp ${${_NAME}_FIND_COMPONENTS})
    if(NOT ${_NAME}_${comp}_FOUND)
      if(${_NAME}_FIND_REQUIRED_${comp})
        set(${_NAME}_FOUND FALSE)
      endif()
    endif()
  endforeach()
endmacro()

####################################################################################

set(PN v2rdm_casscf)

check_required_components(${PN})

#-----------------------------------------------------------------------------
# Don't include targets if this file is being picked up by another
# project which has already built this as a subproject
#-----------------------------------------------------------------------------
if(NOT TARGET ${PN}::v2rdm_casscf)
    include("${CMAKE_CURRENT_LIST_DIR}/${PN}Targets.cmake")

    get_property(_loc TARGET ${PN}::v2rdm_casscf PROPERTY LOCATION)
    set(${PN}_LIBRARY ${_loc})
    set(${PN}_LIBRARIES ${_loc})
endif()

