# - Try to find evolution-data-server components
# Set evolution-data-server headers, libraries and the answer to all questions.
#
#  EVOLUTIONDATASERVER_INCLUDE_DIRS         Location of evolution-data-server headers 
#  EVOLUTIONDATASERVER_LIBRARIES           List of libraries to use evolution-data-server
#  EVOLUTIONDATASERVER_LIBRARY_DIRS           Pathes of libraries to use evolution-data-server
#  EVOLUTIONDATASERVER_LDFLAGS           List of link flags to use evolution-data-server
#
#  LIBEBOOK_INCLUDE_DIRS         Location of libebook headers 
#  LIBEBOOK_LIBRARIES           List of libraries to use libebook
#  LIBEBOOK_LIBRARY_DIRS           Pathes of libraries to use libebook
#  LIBEBOOK_LDFLAGS           List of link flags to use libebook
#
#  LIBECAL_INCLUDE_DIRS         Location of libecal headers 
#  LIBECAL_LIBRARIES           List of libraries to use libecal
#  LIBECAL_LIBRARY_DIRS           Pathes of libraries to use libecal
#  LIBECAL_LDFLAGS           List of link flags to use libecal
#
#  LIBEDATABOOK_INCLUDE_DIRS         Location of libedata-book headers 
#  LIBEDATABOOK_LIBRARIES           List of libraries to use libedata-book
#  LIBEDATABOOK_LIBRARY_DIRS           Pathes of libraries to use libedata-book
#  LIBEDATABOOK_LDFLAGS           List of link flags to use libedata-book
#
#  LIBEDATACAL_INCLUDE_DIRS         Location of libedata-cal headers 
#  LIBEDATACAL_LIBRARIES           List of libraries to use libedata-cal
#  LIBEDATACAL_LIBRARY_DIRS           Pathes of libraries to use libedata-cal
#  LIBEDATACAL_LDFLAGS           List of link flags to use libedata-cal
#
#  LIBEDATASERVER_INCLUDE_DIRS         Location of libedataserver headers 
#  LIBEDATASERVER_LIBRARIES           List of libraries to use libedataserver
#  LIBEDATASERVER_LIBRARY_DIRS           Pathes of libraries to use libedataserver
#  LIBEDATASERVER_LDFLAGS           List of link flags to use libedataserver
#
# Copyright (c) 2007 Alban Browaeys <prahal@yahoo.com>
#
#  Redistribution and use is allowed according to the terms of the New
#  BSD license.
#  For details see the accompanying COPYING-CMAKE-SCRIPTS file.
#


FIND_PACKAGE ( EvolutionDataServer1.2 )
FIND_PACKAGE ( EBook1.2 )
FIND_PACKAGE ( ECal1.2 )
FIND_PACKAGE ( EDataBook1.2 )
FIND_PACKAGE ( EDataCal1.2 )
FIND_PACKAGE ( EDataServer1.2 )
IF ( EVOLUTIONDATASERVER1.2_LIBRARIES AND EVOLUTIONDATASERVER1.2_INCLUDE_DIRS )       
	IF ( LIBEBOOK1.2_LIBRARIES AND LIBEBOOK1.2_INCLUDE_DIRS )       
		IF ( LIBECAL1.2_LIBRARIES AND LIBECAL1.2_INCLUDE_DIRS ) 
			IF ( LIBEDATABOOK1.2_LIBRARIES AND LIBEDATABOOK1.2_INCLUDE_DIRS )       
				IF ( LIBEDATACAL1.2_LIBRARIES AND LIBEDATACAL1.2_INCLUDE_DIRS ) 
					IF ( LIBEDATASERVER1.2_LIBRARIES AND LIBEDATASERVER1.2_INCLUDE_DIRS )   
						SET( EDS1.2_FOUND 1 )
					ELSE ( LIBEDATASERVER1.2_LIBRARIES AND LIBEDATASERVER1.2_INCLUDE_DIRS ) 
						SET( EDS1.2_FOUND 0 )
					ENDIF ( LIBEDATASERVER1.2_LIBRARIES AND LIBEDATASERVER1.2_INCLUDE_DIRS )        
				ELSE ( LIBEDATACAL1.2_LIBRARIES AND LIBEDATACAL1.2_INCLUDE_DIRS )       
					SET( EDS1.2_FOUND 0 )
				ENDIF ( LIBEDATACAL1.2_LIBRARIES AND LIBEDATACAL1.2_INCLUDE_DIRS )      
			ELSE ( LIBEDATABOOK1.2_LIBRARIES AND LIBEDATABOOK1.2_INCLUDE_DIRS )     
				SET( EDS1.2_FOUND 0 )
			ENDIF ( LIBEDATABOOK1.2_LIBRARIES AND LIBEDATABOOK1.2_INCLUDE_DIRS )    
		ELSE ( LIBECAL1.2_LIBRARIES AND LIBECAL1.2_INCLUDE_DIRS )       
			SET( EDS1.2_FOUND 0 )
		ENDIF ( LIBECAL1.2_LIBRARIES AND LIBECAL1.2_INCLUDE_DIRS )      
	ELSE ( LIBEBOOK1.2_LIBRARIES AND LIBEBOOK1.2_INCLUDE_DIRS )     
		SET( EDS1.2_FOUND 0 )
	ENDIF ( LIBEBOOK1.2_LIBRARIES AND LIBEBOOK1.2_INCLUDE_DIRS )    
ELSE ( EVOLUTIONDATASERVER1.2_LIBRARIES AND EVOLUTIONDATASERVER1.2_INCLUDE_DIRS )     
        SET( EDS1.2_FOUND 0 )
ENDIF ( EVOLUTIONDATASERVER1.2_LIBRARIES AND EVOLUTIONDATASERVER1.2_INCLUDE_DIRS )    


IF ( NOT EDS1.2_FOUND )
	FIND_PACKAGE ( EvolutionDataServer1.0 )
	FIND_PACKAGE ( EBook1.0 )
	FIND_PACKAGE ( ECal1.0 )
	FIND_PACKAGE ( EDataBook1.0 )
	FIND_PACKAGE ( EDataCal1.0 )
	FIND_PACKAGE ( EDataServer1.0 )
	IF ( EVOLUTIONDATASERVER1.0_LIBRARIES AND EVOLUTIONDATASERVER1.0_INCLUDE_DIRS )       
		IF ( LIBEBOOK1.0_LIBRARIES AND LIBEBOOK1.0_INCLUDE_DIRS )       
			IF ( LIBECAL1.0_LIBRARIES AND LIBECAL1.0_INCLUDE_DIRS ) 
				IF ( LIBEDATABOOK1.0_LIBRARIES AND LIBEDATABOOK1.0_INCLUDE_DIRS )       
					IF ( LIBEDATACAL1.0_LIBRARIES AND LIBEDATACAL1.0_INCLUDE_DIRS ) 
						IF ( LIBEDATASERVER1.0_LIBRARIES AND LIBEDATASERVER1.0_INCLUDE_DIRS )   
							SET( EDS1.0_FOUND 1 )
						ELSE ( LIBEDATASERVER1.0_LIBRARIES AND LIBEDATASERVER1.0_INCLUDE_DIRS ) 
							SET( EDS1.0_FOUND 0 )
						ENDIF ( LIBEDATASERVER1.0_LIBRARIES AND LIBEDATASERVER1.0_INCLUDE_DIRS )        
					ELSE ( LIBEDATACAL1.0_LIBRARIES AND LIBEDATACAL1.0_INCLUDE_DIRS )       
						SET( EDS1.0_FOUND 0 )
					ENDIF ( LIBEDATACAL1.0_LIBRARIES AND LIBEDATACAL1.0_INCLUDE_DIRS )      
				ELSE ( LIBEDATABOOK1.0_LIBRARIES AND LIBEDATABOOK1.0_INCLUDE_DIRS )     
					SET( EDS1.0_FOUND 0 )
				ENDIF ( LIBEDATABOOK1.0_LIBRARIES AND LIBEDATABOOK1.0_INCLUDE_DIRS )    
			ELSE ( LIBECAL1.0_LIBRARIES AND LIBECAL1.0_INCLUDE_DIRS )       
				SET( EDS1.0_FOUND 0 )
			ENDIF ( LIBECAL1.0_LIBRARIES AND LIBECAL1.0_INCLUDE_DIRS )      
		ELSE ( LIBEBOOK1.0_LIBRARIES AND LIBEBOOK1.0_INCLUDE_DIRS )     
			SET( EDS1.0_FOUND 0 )
		ENDIF ( LIBEBOOK1.0_LIBRARIES AND LIBEBOOK1.0_INCLUDE_DIRS )    
	ELSE ( EVOLUTIONDATASERVER1.0_LIBRARIES AND EVOLUTIONDATASERVER1.0_INCLUDE_DIRS )     
		SET( EDS1.0_FOUND 0 )
	ENDIF ( EVOLUTIONDATASERVER1.0_LIBRARIES AND EVOLUTIONDATASERVER1.0_INCLUDE_DIRS )    
ENDIF ( NOT EDS1.2_FOUND )




IF ( EDS1.2_FOUND )
  MESSAGE( STATUS "Evolution Data Server 1.2 used." )
  SET( EVOLUTIONDATASERVER_INCLUDE_DIRS ${EVOLUTIONDATASERVER1.2_INCLUDE_DIRS} )
  SET( EVOLUTIONDATASERVER_LIBRARIES ${EVOLUTIONDATASERVER1.2_LIBRARIES} )
  SET( EVOLUTIONDATASERVER_LIBRARY_DIRS ${EVOLUTIONDATASERVER1.2_LIBRARY_DIRS} )
  SET( EVOLUTIONDATASERVER_LDFLAGS ${EVOLUTIONDATASERVER1.2_LDFLAGS} )
  SET( LIBEBOOK_INCLUDE_DIRS ${LIBEBOOK1.2_INCLUDE_DIRS} )
  SET( LIBEBOOK_LIBRARIES ${LIBEBOOK1.2_LIBRARIES} )
  SET( LIBEBOOK_LIBRARY_DIRS ${LIBEBOOK1.2_LIBRARY_DIRS} )
  SET( LIBEBOOK_LDFLAGS ${LIBEBOOK1.2_LDFLAGS} )
  SET( LIBECAL_INCLUDE_DIRS ${LIBECAL1.2_INCLUDE_DIRS} )
  SET( LIBECAL_LIBRARIES ${LIBECAL1.2_LIBRARIES} )
  SET( LIBECAL_LIBRARY_DIRS ${LIBECAL1.2_LIBRARY_DIRS} )
  SET( LIBECAL_LDFLAGS ${LIBECAL1.2_LDFLAGS} )
  SET( LIBEDATABOOK_INCLUDE_DIRS ${LIBEDATABOOK1.2_INCLUDE_DIRS} )
  SET( LIBEDATABOOK_LIBRARIES ${LIBEDATABOOK1.2_LIBRARIES} )
  SET( LIBEDATABOOK_LIBRARY_DIRS ${LIBEDATABOOK1.2_LIBRARY_DIRS} )
  SET( LIBEDATABOOK_LDFLAGS ${LIBEDATABOOK1.2_LDFLAGS} )
  SET( LIBEDATACAL_INCLUDE_DIRS ${LIBEDATACAL1.2_INCLUDE_DIRS} )
  SET( LIBEDATACAL_LIBRARIES ${LIBEDATACAL1.2_LIBRARIES} )
  SET( LIBEDATACAL_LIBRARY_DIRS ${LIBEDATACAL1.2_LIBRARY_DIRS} )
  SET( LIBEDATACAL_LDFLAGS ${LIBEDATACAL1.2_LDFLAGS} )
  SET( LIBEDATASERVER_INCLUDE_DIRS ${LIBEDATASERVER1.2_INCLUDE_DIRS} )
  SET( LIBEDATASERVER_LIBRARIES ${LIBEDATASERVER1.2_LIBRARIES} )
  SET( LIBEDATASERVER_LIBRARY_DIRS ${LIBEDATASERVER1.2_LIBRARY_DIRS} )
  SET( LIBEDATASERVER_LDFLAGS ${LIBEDATASERVER1.2_LDFLAGS} )
ELSE ( EDS1.2_FOUND )
  IF ( EDS1.0_FOUND )
    MESSAGE( STATUS "Evolution Data Server 1.0 used." )
    SET( EVOLUTIONDATASERVER_INCLUDE_DIRS ${EVOLUTIONDATASERVER1.0_INCLUDE_DIRS} )
    SET( EVOLUTIONDATASERVER_LIBRARIES ${EVOLUTIONDATASERVER1.2_LIBRARIES} )
    SET( EVOLUTIONDATASERVER_LIBRARY_DIRS ${EVOLUTIONDATASERVER1.2_LIBRARY_DIRS} )
    SET( EVOLUTIONDATASERVER_LDFLAGS ${EVOLUTIONDATASERVER1.2_LDFLAGS} )
    SET( LIBEBOOK_INCLUDE_DIRS ${LIBEBOOK1.0_INCLUDE_DIRS} )
    SET( LIBEBOOK_LIBRARIES ${LIBEBOOK1.0_LIBRARIES} )
    SET( LIBEBOOK_LIBRARY_DIRS ${LIBEBOOK1.0_LIBRARY_DIRS} )
    SET( LIBEBOOK_LDFLAGS ${LIBEBOOK1.0_LDFLAGS} )
    SET( LIBECAL_INCLUDE_DIRS ${LIBECAL1.0_INCLUDE_DIRS} )
    SET( LIBECAL_LIBRARIES ${LIBECAL1.0_LIBRARIES} )
    SET( LIBECAL_LIBRARY_DIRS ${LIBECAL1.0_LIBRARY_DIRS} )
    SET( LIBECAL_LDFLAGS ${LIBECAL1.0_LDFLAGS} )
    SET( LIBEDATABOOK_INCLUDE_DIRS ${LIBEDATABOOK1.0_INCLUDE_DIRS} )
    SET( LIBEDATABOOK_LIBRARIES ${LIBEDATABOOK1.0_LIBRARIES} )
    SET( LIBEDATABOOK_LIBRARY_DIRS ${LIBEDATABOOK1.0_LIBRARY_DIRS} )
    SET( LIBEDATABOOK_LDFLAGS ${LIBEDATABOOK1.0_LDFLAGS} )
    SET( LIBEDATACAL_INCLUDE_DIRS ${LIBEDATACAL1.0_INCLUDE_DIRS} )
    SET( LIBEDATACAL_LIBRARIES ${LIBEDATACAL1.0_LIBRARIES} )
    SET( LIBEDATACAL_LIBRARY_DIRS ${LIBEDATACAL1.0_LIBRARY_DIRS} )
    SET( LIBEDATACAL_LDFLAGS ${LIBEDATACAL1.0_LDFLAGS} )
    SET( LIBEDATASERVER_INCLUDE_DIRS ${LIBEDATASERVER1.0_INCLUDE_DIRS} )
    SET( LIBEDATASERVER_LIBRARIES ${LIBEDATASERVER1.0_LIBRARIES} )
    SET( LIBEDATASERVER_LIBRARY_DIRS ${LIBEDATASERVER1.0_LIBRARY_DIRS} )
    SET( LIBEDATASERVER_LDFLAGS ${LIBEDATASERVER1.0_LDFLAGS} )
  ELSE ( EDS1.0_FOUND )
    MESSAGE( FATAL_ERROR "Evolution Data Server not found." )
  ENDIF ( EDS1.0_FOUND )
ENDIF ( EDS1.2_FOUND )

