if (NOT Range_FOUND)
  if (Range_FIND_REQUIRED)
    set(_cet_Range_FIND_REQUIRED ${Range_FIND_REQUIRED})
    unset(Range_FIND_REQUIRED)
  else()
    unset(_cet_Range_FIND_REQUIRED)
  endif()
  find_package(Range CONFIG QUIET)
  if (_cet_Range_FIND_REQUIRED)
    set(Range_FIND_REQUIRED ${_cet_Range_FIND_REQUIRED})
    unset(_cet_Range_FIND_REQUIRED)
  endif()
  if (Range_FOUND)
    set(_cet_Range_config_mode CONFIG_MODE)
  else()
    unset(_cet_Range_config_mode)
  endif()
endif()
if (NOT Range_FOUND)
  find_file(_cet_Range_hpp NAMES range_fwd.hpp HINTS ENV RANGE_INC
    PATH_SUFFIXES range/v3)
  if (_cet_Range_hpp)
    get_filename_component(_cet_Range_include_dir "${_cet_Range_hpp}" PATH)
    get_filename_component(_cet_Range_include_dir "${_cet_Range_include_dir}" PATH)
    get_filename_component(_cet_Range_include_dir "${_cet_Range_include_dir}" PATH)
    if (_cet_Range_include_dir STREQUAL "/")
      unset(_cet_Range_include_dir)
    endif()
  endif()
  if (EXISTS "${_cet_Range_include_dir}")
    set(Range_FOUND TRUE)
    set(RANGE_FOUND TRUE)
  endif()
endif()
if (Range_FOUND AND _cet_Range_include_dir AND NOT TARGET Range::Range)
  add_library(Range::Range INTERFACE IMPORTED)
  set_target_properties(Range::Range PROPERTIES
    INTERFACE_INCLUDE_DIRECTORIES "${_cet_Range_include_dir}")
endif()

set(Range_FIND_REQUIRED ${_cet_Range_FIND_REQUIRED})
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(Range ${_cet_Range_config_mode}
  REQUIRED_VARS Range_FOUND)

unset(_cet_Range_FIND_REQUIRED)
unset(_cet_Range_config_mode)
unset(_cet_Range_hpp CACHE)
