# - Find Oyranos
# Find the native Oyranos headers and libraries.
#
#  OYRANOS_FOUND        - True if Oyranos found.
#  OYRANOS_INCLUDE_DIRS - where to find kdb.h, etc.
#  OYRANOS_LIBRARIES    - List of libraries when using Oyranos.
#  OYRANOS_LIBRARY_DIRS - where to find libraries
#
#  OYRANOS_VERSION       - The version of oyranos (x.y.z)
#  OYRANOS_VERSION_MAJOR - The major version of oyranos (x)
#  OYRANOS_VERSION_MINOR - The minor version of oyranos (y)
#  OYRANOS_VERSION_MICRO - The patch version of oyranos (z)
#
#  OYRANOS_CMM_SUBDIR    - usually "color/modules"
#  OYRANOS_META_SUBDIR   - usually "oyranos-meta"
#  OYRANOS_CMM_DIR       - Oyranos install prefix / lib+LIBSUFFIX / OYRANOS_CMM_SUBDIR
#  OYRANOS_META_DIR      - similar to the above for meta module(s)
#  OYRANOS_ICC_DIR       - similar to the above for ICC profiles
#  OYRANOS_SETTINGS_DIR  - similar to the above for policy files
#  OYRANOS_FRAMEWORK_LOCALE_DIR - Oyranos locale path inside OyranosCore.framework/Resources/
#  OYRANOS_FRAMEWORK_LOCALE     - OyranosCore.framework  OS X framework containing translations
#  OYRANOS_FRAMEWORK_ICC        - Oyranos.framework      OS X framework containing ICC profiles
#  OYRANOS_LINGUAS       - Oyranos translation languages
#
#  OYRANOS_INCLUDE_DIR         - Include of of the Oyranos.framework Headers path
#  OYRANOS_CONFIG_INCLUDE_DIR  - Include of of the OyranosConfig.framework Headers path
#  OYRANOS_MODULES_INCLUDE_DIR - Include of of the OyranosModules.framework Headers path
#  OYRANOS_OBJECT_INCLUDE_DIR  - Include of of the OyranosObject.framework Headers path
#  OYRANOS_CORE_INCLUDE_DIR    - Include of of the OyranosCore.framework Headers path
#
#  OYRANOS_MODULE_LIBRARIES    - Additional framework install libraries
#
#  OYRANOS_CORE_LIBRARIES      - library for core API
#  OYRANOS_OBJECT_LIBRARIES    - libraries for object API + above
#  OYRANOS_MODULES_LIBRARIES   - libraries for module API + above
#  OYRANOS_CONFIG_LIBRARIES    - libraries for config API + above
#  OYRANOS_LIBRARIES           - libraries for imaging API + above
#
#  OYRANOS_CORE_LIBRARIES_EXTRA    - linked libraries
#  OYRANOS_OBJECT_LIBRARIES_EXTRA  - linked libraries
#  OYRANOS_MODULES_LIBRARIES_EXTRA - linked libraries
#  OYRANOS_CONFIG_LIBRARIES_EXTRA  - linked libraries
#  OYRANOS_LIBRARIES_EXTRA         - linked libraries
#
#  HAVE_OYRANOS          - TRUE



# Set path to the header file.
IF(APPLE)
  FIND_PATH(OYRANOS_INCLUDE_DIR
	NAMES oyranos_profile.h
	PATHS @CMAKE_INSTALL_PREFIX@/@FRAMEWORK_DIR@/@PROJECT_NAME@.framework/Headers
	NO_DEFAULT_PATH
  )
  FIND_PATH(OYRANOS_CONFIG_INCLUDE_DIR
	NAMES oyranos_devices.h
	PATHS @CMAKE_INSTALL_PREFIX@/@FRAMEWORK_DIR@/@PROJECT_NAME@Config.framework/Headers
	NO_DEFAULT_PATH
  )
  FIND_PATH(OYRANOS_MODULES_INCLUDE_DIR
	NAMES oyranos_module.h
	PATHS @CMAKE_INSTALL_PREFIX@/@FRAMEWORK_DIR@/@PROJECT_NAME@Modules.framework/Headers
	NO_DEFAULT_PATH
  )
  FIND_PATH(OYRANOS_OBJECT_INCLUDE_DIR
	NAMES oyranos_object.h
	PATHS @CMAKE_INSTALL_PREFIX@/@FRAMEWORK_DIR@/@PROJECT_NAME@Object.framework/Headers
	NO_DEFAULT_PATH
  )
  FIND_PATH(OYRANOS_CORE_INCLUDE_DIR
	NAMES oyranos_core.h
	PATHS @CMAKE_INSTALL_PREFIX@/@FRAMEWORK_DIR@/@PROJECT_NAME@Core.framework/Headers
	NO_DEFAULT_PATH
  )
ELSE(APPLE)
  FIND_PATH(OYRANOS_INCLUDE_DIR
	NAMES oyranos.h
	PATHS @CMAKE_INSTALL_PREFIX@/include/@TARGET_INCLUDE_FOLDER@
	NO_DEFAULT_PATH
  )
ENDIF(APPLE)
MARK_AS_ADVANCED(OYRANOS_INCLUDE_DIR)

# Set path to the library.
FIND_LIBRARY(OYRANOS_CORE_LIBRARY
	NAMES @PROJECT_NAME@Core
	PATHS @CMAKE_INSTALL_PREFIX@/@LIB_DIR@
	NO_DEFAULT_PATH
)
SET( OYRANOS_CORE_LIBRARIES ${OYRANOS_CORE_LIBRARY} )
MARK_AS_ADVANCED(OYRANOS_CORE_LIBRARIES)
FIND_LIBRARY(OYRANOS_OBJECT_LIBRARY
	NAMES @PROJECT_NAME@Object
	PATHS @CMAKE_INSTALL_PREFIX@/@LIB_DIR@
	NO_DEFAULT_PATH
)
SET( OYRANOS_OBJECT_LIBRARIES ${OYRANOS_OBJECT_LIBRARY} ${OYRANOS_CORE_LIBRARY} )
MARK_AS_ADVANCED(OYRANOS_OBJECT_LIBRARIES)
FIND_LIBRARY(OYRANOS_MODULES_LIBRARY
	NAMES @PROJECT_NAME@Modules
	PATHS @CMAKE_INSTALL_PREFIX@/@LIB_DIR@
	NO_DEFAULT_PATH
)
SET( OYRANOS_MODULES_LIBRARIES ${OYRANOS_MODULES_LIBRARY} ${OYRANOS_OBJECT_LIBRARY} ${OYRANOS_CORE_LIBRARY} )
MARK_AS_ADVANCED(OYRANOS_MODULES_LIBRARIES)
FIND_LIBRARY(OYRANOS_CONFIG_LIBRARY
	NAMES @PROJECT_NAME@Config
	PATHS @CMAKE_INSTALL_PREFIX@/@LIB_DIR@
	NO_DEFAULT_PATH
)
SET( OYRANOS_CONFIG_LIBRARIES ${OYRANOS_CONFIG_LIBRARY} ${OYRANOS_MODULES_LIBRARY} ${OYRANOS_OBJECT_LIBRARY} ${OYRANOS_CORE_LIBRARY} )
MARK_AS_ADVANCED(OYRANOS_CONFIG_LIBRARIES)
FIND_LIBRARY(OYRANOS_LIBRARY
	NAMES @PROJECT_NAME@
	PATHS @CMAKE_INSTALL_PREFIX@/@LIB_DIR@
	NO_DEFAULT_PATH
)
SET( OYRANOS_LIBRARIES ${OYRANOS_LIBRARY} ${OYRANOS_CONFIG_LIBRARY} ${OYRANOS_MODULES_LIBRARY} ${OYRANOS_OBJECT_LIBRARY} ${OYRANOS_CORE_LIBRARY} )
MARK_AS_ADVANCED(OYRANOS_LIBRARIES)

# handle the QUIETLY and REQUIRED arguments and set OYRANOS_FOUND to TRUE if
# all listed variables are TRUE
INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(Oyranos DEFAULT_MSG OYRANOS_LIBRARY OYRANOS_INCLUDE_DIR)

if (OYRANOS_FOUND)
        SET( OYRANOS_VERSION_MAJOR @OYRANOS_VERSION_MAJOR@ )
        SET( OYRANOS_VERSION_MINOR @OYRANOS_VERSION_MINOR@ )
        SET( OYRANOS_VERSION_MICRO @OYRANOS_VERSION_MICRO@ )
        SET( OYRANOS_VERSION       @OYRANOS_VERSION@ )
        SET( OYRANOS_CMM_SUBDIR    @OY_CMMSUBPATH@ )
        SET( OYRANOS_META_SUBDIR   @OY_METASUBPATH@ )
        SET( OYRANOS_CMM_DIR       @CMAKE_INSTALL_PREFIX@/lib@LIB_SUFFIX@/@OY_CMMSUBPATH@ )
        SET( OYRANOS_META_DIR      @CMAKE_INSTALL_PREFIX@/lib@LIB_SUFFIX@/@OY_METASUBPATH@ )
        SET( OYRANOS_ICC_DIR       @OY_ICC_DIR@ )
        SET( OYRANOS_SETTINGS_DIR  @CMAKE_INSTALL_PREFIX@/share/color/settings )
        SET( OYRANOS_FRAMEWORK_LOCALE_DIR locale )
        SET( OYRANOS_FRAMEWORK_LOCALE     OyranosCore.framework )
        SET( OYRANOS_FRAMEWORK_ICC        Oyranos.framework )
        SET( OYRANOS_MODULE_LIBRARIES     @OY_MODULE_LIBRARIES@ )
        SET( OYRANOS_CORE_LIBRARIES_EXTRA    @EXTRA_LIBS_CORE@ )
        SET( OYRANOS_OBJECT_LIBRARIES_EXTRA  @EXTRA_LIBS_CORE@ )
        SET( OYRANOS_MODULES_LIBRARIES_EXTRA @EXTRA_LIBS_CORE@ @EXTRA_LIBS@ )
        SET( OYRANOS_CONFIG_LIBRARIES_EXTRA  @EXTRA_LIBS_CORE@ @EXTRA_LIBS@ @EXTRA_LIBS_CONFIG@ )
        SET( OYRANOS_LIBRARIES_EXTRA         @EXTRA_LIBS_CORE@ @EXTRA_LIBS@ @EXTRA_LIBS_CONFIG@ )
        SET( OYRANOS_LINGUAS       @OY_LINGUAS@ )
        SET( HAVE_OYRANOS          TRUE )
	SET( OYRANOS_INCLUDE_DIRS
             ${OYRANOS_INCLUDE_DIR}
             ${OYRANOS_CONFIG_INCLUDE_DIR}
             ${OYRANOS_MODULES_INCLUDE_DIR}
             ${OYRANOS_OBJECT_INCLUDE_DIR}
             ${OYRANOS_CORE_INCLUDE_DIR}
           )
        SET( OYRANOS_LIBRARY_DIRS @CMAKE_INSTALL_PREFIX@/@LIB_DIR@ )
endif (OYRANOS_FOUND)
