#
# This files contains definitions needed to use CGAL in a program.
# DO NOT EDIT THIS. The definitons have been generated by CMake at configuration time.
# This file is loaded by cmake via the command "find_package(CGAL)"
#
# This file correspond to a possibly out-of-sources CGAL configuration, thus the actual location
# must be given by the cmake variable or enviroment variable CGAL_DIR.

set(CGAL_CONFIG_LOADED TRUE)

get_filename_component(CGAL_CONFIG_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH)

set(CGAL_HEADER_ONLY "@CGAL_HEADER_ONLY@" )

# The code for including exported targets is different from
# CGAL_Config_install.cmake. We do not have separate export files in
# an installed version and we need to make sure that we are not
# currently building CGAL. Note that for CMake<=2.8.11 (detected by
# the absence of CMP0024), the else() condition is never used.
if(NOT POLICY CMP0024 OR NOT CGAL_BUILDING_LIBS)
  include("${CGAL_CONFIG_DIR}/CGALExports.cmake")

  macro(CGAL_get_property_optional VAR TARGET PROPERTY)
    if(TARGET ${TARGET})
      get_property(${VAR} TARGET ${TARGET} PROPERTY ${PROPERTY})
    else()
      set(${VAR} "")
    endif()
  endmacro()

  if(NOT MSVC AND NOT CGAL_HEADER_ONLY)
    CGAL_get_property_optional(CGAL_LIBRARY CGAL::CGAL LOCATION)
    CGAL_get_property_optional(CGAL_Core_LIBRARY CGAL::CGAL_Core LOCATION)
    CGAL_get_property_optional(CGAL_ImageIO_LIBRARY CGAL::CGAL_ImageIO LOCATION)
    CGAL_get_property_optional(CGAL_Qt5_LIBRARY CGAL::CGAL_Qt5 LOCATION)
  else()
    set(CGAL_LIBRARY         "")
    set(CGAL_Core_LIBRARY    "")
    set(CGAL_ImageIO_LIBRARY "")
    set(CGAL_Qt5_LIBRARY     "")
  endif()
else()
  # We are currently in a CGAL Build and CGALExports.cmake has not
  # necessarily been created yet. Just alias the targets. Also don't
  # access the LOCATION property here to set lib_LIBRARY, since those
  # targets are not imported and this is disallowed by CMP0026. Just
  # set it to the target name.
  macro(CGAL_alias_library lib)
    if(TARGET ${lib} AND NOT TARGET CGAL::${lib})
      add_library(CGAL::${lib} ALIAS ${lib})
      set(${lib}_LIBRARY CGAL::${lib})
    else()
      set(${lib}_LIBRARY "")
    endif()
  endmacro()

  CGAL_alias_library(CGAL)
  CGAL_alias_library(CGAL_Core)
  CGAL_alias_library(CGAL_ImageIO)
  CGAL_alias_library(CGAL_Qt5)
endif()

# Check for possible config files of our libraries and include them.
file(GLOB CGAL_CONFIG_FILES LIST_DIRECTORIES false
  RELATIVE "${CGAL_CONFIG_DIR}" "${CGAL_CONFIG_DIR}/*LibConfig.cmake")
list(SORT CGAL_CONFIG_FILES)
foreach(configfile ${CGAL_CONFIG_FILES})
  include("${CGAL_CONFIG_DIR}/${configfile}")
endforeach()

set(CGAL_INSTALLATION_PACKAGE_DIR "@CGAL_INSTALLATION_PACKAGE_DIR@")
set(CGAL_CORE_PACKAGE_DIR "@CGAL_CORE_PACKAGE_DIR@")
set(CGAL_GRAPHICSVIEW_PACKAGE_DIR "@CGAL_GRAPHICSVIEW_PACKAGE_DIR@")

set(CGAL_MAJOR_VERSION    "@CGAL_MAJOR_VERSION@" )
set(CGAL_MINOR_VERSION    "@CGAL_MINOR_VERSION@" )
set(CGAL_BUGFIX_VERSION   "@CGAL_BUGFIX_VERSION@" )
set(CGAL_BUILD_VERSION    "@CGAL_BUILD_VERSION@" )
set(CGAL_SCM_BRANCH_NAME  "@CGAL_SCM_BRANCH_NAME@")
set(CGAL_GIT_SHA1         "@CGAL_GIT_SHA1@")

set(CGAL_BUILD_SHARED_LIBS        "@CGAL_BUILD_SHARED_LIBS@" )
set(CGAL_Boost_USE_STATIC_LIBS    "@CGAL_Boost_USE_STATIC_LIBS@" )

set(CGAL_CXX_FLAGS_INIT                   "@CMAKE_CXX_FLAGS@" )
set(CGAL_CXX_FLAGS_RELEASE_INIT           "@CMAKE_CXX_FLAGS_RELEASE@" )
set(CGAL_CXX_FLAGS_DEBUG_INIT             "@CMAKE_CXX_FLAGS_DEBUG@" )
set(CGAL_MODULE_LINKER_FLAGS_INIT         "@CMAKE_MODULE_LINKER_FLAGS@" )
set(CGAL_MODULE_LINKER_FLAGS_RELEASE_INIT "@CMAKE_MODULE_LINKER_FLAGS_RELEASE@" )
set(CGAL_MODULE_LINKER_FLAGS_DEBUG_INIT   "@CMAKE_MODULE_LINKER_FLAGS_DEBUG@" )
set(CGAL_SHARED_LINKER_FLAGS_INIT         "@CMAKE_SHARED_LINKER_FLAGS@" )
set(CGAL_SHARED_LINKER_FLAGS_RELEASE_INIT "@CMAKE_SHARED_LINKER_FLAGS_RELEASE@" )
set(CGAL_SHARED_LINKER_FLAGS_DEBUG_INIT   "@CMAKE_SHARED_LINKER_FLAGS_DEBUG@" )
set(CGAL_BUILD_TYPE_INIT                  "@CMAKE_BUILD_TYPE@" )

set(CGAL_INCLUDE_DIRS      "@CGAL_INCLUDE_DIRS@" )
set(CGAL_MODULES_DIR       "@CGAL_MODULES_DIR@" )
set(CGAL_LIBRARIES_DIR     "@CGAL_LIBRARIES_DIR@" )

# If CGAL_ImageIO is built, tell if it was linked with Zlib.
set(CGAL_ImageIO_USE_ZLIB                 "@CGAL_ImageIO_USE_ZLIB@" )

set(CGAL_VERSION "${CGAL_MAJOR_VERSION}.${CGAL_MINOR_VERSION}.${CGAL_BUGFIX_VERSION}")

set(CGAL_USE_FILE "${CGAL_MODULES_DIR}/UseCGAL.cmake" )

if ( CGAL_FIND_REQUIRED )
  set( CHECK_CGAL_COMPONENT_MSG_ON_ERROR TRUE        )
  set( CHECK_CGAL_COMPONENT_ERROR_TYPE   FATAL_ERROR )
  set( CHECK_CGAL_COMPONENT_ERROR_TITLE  "ERROR:"    )
else()
  if ( NOT CGAL_FIND_QUIETLY )
    set( CHECK_CGAL_COMPONENT_MSG_ON_ERROR TRUE      )
    set( CHECK_CGAL_COMPONENT_ERROR_TYPE   STATUS    )
    set( CHECK_CGAL_COMPONENT_ERROR_TITLE "NOTICE:" )
  else()
    set( CHECK_CGAL_COMPONENT_MSG_ON_ERROR FALSE )
  endif()
endif()

set(CGAL_CONFIGURED_LIBRARIES "@CGAL_CONFIGURED_LIBRARIES@")

macro(check_cgal_component COMPONENT)

  set( CGAL_LIB ${COMPONENT} )
  #message("LIB: ${CGAL_LIB}")

  if ( "${CGAL_LIB}" STREQUAL "CGAL" )
    set( CGAL_FOUND TRUE )
    set( CHECK_CGAL_ERROR_TAIL "" )
  else( "${CGAL_LIB}" STREQUAL "CGAL" )
    if ( WITH_${CGAL_LIB} )
      if(CGAL_HEADER_ONLY OR TARGET CGAL::${CGAL_LIB})
        if ("${CGAL_LIB}" STREQUAL "CGAL_Qt5")
          find_package(Qt5 QUIET COMPONENTS OpenGL Svg)
          find_package(OpenGL QUIET)

          set(CGAL_Qt5_MISSING_DEPS "")
          if(NOT Qt5OpenGL_FOUND)
            set(CGAL_Qt5_MISSING_DEPS "Qt5OpenGL")
          endif()
          if(NOT Qt5Svg_FOUND)
            set(CGAL_Qt5_MISSING_DEPS "${CGAL_Qt5_MISSING_DEPS} Qt5Svg")
          endif()
          if(NOT Qt5_FOUND)
            set(CGAL_Qt5_MISSING_DEPS "${CGAL_Qt5_MISSING_DEPS} Qt5")
          endif()
          if(NOT OPENGL_FOUND)
            set(CGAL_Qt5_MISSING_DEPS "${CGAL_Qt5_MISSING_DEPS} OpenGL")
          endif()

          if(CGAL_Qt5_MISSING_DEPS)
            set( ${CGAL_LIB}_FOUND FALSE )
            message(STATUS "libCGAL_Qt5 is missing the dependencies: ${CGAL_Qt5_MISSING_DEPS} cannot be configured.")
          else()
            set( ${CGAL_LIB}_FOUND TRUE )
            if (CGAL_HEADER_ONLY)
              include("${CGAL_MODULES_DIR}/Use_CGAL_Qt5_headers.cmake")
            endif()
          endif()
        else("${CGAL_LIB}" STREQUAL "CGAL_Qt5")
          # Librairies that have no dependencies
          set( ${CGAL_LIB}_FOUND TRUE )
        endif("${CGAL_LIB}" STREQUAL "CGAL_Qt5")
      else(CGAL_HEADER_ONLY OR TARGET CGAL::${CGAL_LIB})
        set( ${CGAL_LIB}_FOUND FALSE )
        set( CHECK_${CGAL_LIB}_ERROR_TAIL " CGAL was configured with WITH_${CGAL_LIB}=ON, but one of the dependencies of ${CGAL_LIB} was not configured properly." )
      endif(CGAL_HEADER_ONLY OR TARGET CGAL::${CGAL_LIB})
    else( WITH_${CGAL_LIB} )
      set( ${CGAL_LIB}_FOUND FALSE )
      set( CHECK_${CGAL_LIB}_ERROR_TAIL " Please configure CGAL using WITH_${CGAL_LIB}=ON." )
    endif( WITH_${CGAL_LIB} )
  endif( "${CGAL_LIB}" STREQUAL "CGAL" )

  if ( NOT ${CGAL_LIB}_FOUND AND CHECK_CGAL_COMPONENT_MSG_ON_ERROR )
    message( ${CHECK_CGAL_COMPONENT_ERROR_TYPE} "${CHECK_CGAL_COMPONENT_ERROR_TITLE} The ${CGAL_LIB} library was not configured.${CHECK_${CGAL_LIB}_ERROR_TAIL}" )
  endif()

endmacro()

check_cgal_component("CGAL")

foreach( CGAL_COMPONENT ${CGAL_FIND_COMPONENTS} )
  list (FIND CGAL_CONFIGURED_LIBRARIES "CGAL_${CGAL_COMPONENT}" POSITION)
  if ("${POSITION}" STRGREATER "-1") # means: CGAL_COMPONENT is contained in list
    check_cgal_component("CGAL_${CGAL_COMPONENT}")
# TODO EBEB do something for supporting lib in check_component?
  endif()
endforeach()

# Starting with cmake 2.6.3, CGAL_FIND_COMPONENTS is cleared out when find_package returns.
# But we need it within UseCGAL.cmake, so we save it aside into another variable
set( CGAL_REQUESTED_COMPONENTS ${CGAL_FIND_COMPONENTS} )

# for preconfigured libs
set(CGAL_ENABLE_PRECONFIG "@CGAL_ENABLE_PRECONFIG@")
set(CGAL_SUPPORTING_3RD_PARTY_LIBRARIES "@CGAL_SUPPORTING_3RD_PARTY_LIBRARIES@")
set(CGAL_ESSENTIAL_3RD_PARTY_LIBRARIES "@CGAL_ESSENTIAL_3RD_PARTY_LIBRARIES@")

set(CGAL_DISABLE_GMP "@CGAL_DISABLE_GMP@")
