@ -6,7 +6,7 @@
# P O P P L E R _ L I B R A R Y - L i n k t h i s t o u s e p o p p l e r
#
# Copyright ( c ) 2 0 0 6 - 2 0 0 9 , P i n o T o s c a n o , < p i n o @ k d e . o r g >
# Copyright ( c ) 2 0 0 6 - 2 0 1 0 , P i n o T o s c a n o , < p i n o @ k d e . o r g >
#
# R e d i s t r i b u t i o n a n d u s e i s a l l o w e d a c c o r d i n g t o t h e t e r m s o f t h e B S D l i c e n s e .
# F o r d e t a i l s s e e t h e a c c o m p a n y i n g C O P Y I N G - C M A K E - S C R I P T S f i l e .
@ -18,44 +18,45 @@ if(POPPLER_INCLUDE_DIR AND POPPLER_LIBRARY)
else ( POPPLER_INCLUDE_DIR AND POPPLER_LIBRARY )
if ( NOT WIN32 )
# u s e p k g - c o n f i g t o g e t t h e d i r e c t o r i e s a n d t h e n u s e t h e s e v a l u e s
# i n t h e FIND_PATH ( ) a n d FIND_LIBRARY ( ) c a l l s
INCLUDE ( UsePkgConfig )
PKGCONFIG ( poppler-qt4 _PopplerIncDir _PopplerLinkDir _PopplerLinkFlags _PopplerCflags )
if ( _PopplerLinkFlags )
# q u e r y p k g - c o n f i g a s k i n g f o r a p o p p l e r - q t 4 > = 0 . 5 . 4
EXEC_PROGRAM ( ${ PKGCONFIG_EXECUTABLE } ARGS --atleast-version=0.5.4 poppler-qt4 RETURN_VALUE _return_VALUE OUTPUT_VARIABLE _pkgconfigDevNull )
if ( _return_VALUE STREQUAL "0" )
include ( FindPkgConfig )
pkg_check_modules ( _pc_poppler poppler-qt4 )
if ( _pc_poppler_FOUND AND _pc_poppler_VERSION VERSION_GREATER 0.5.3 )
set ( POPPLER_FOUND TRUE )
endif ( _return_VALUE STREQUAL "0" )
else ( _PopplerLinkFlags )
# t r y t o f i n d p o p p l e r w i t h o u t p k g c o n f i g
find_library ( LIBPOPPLER poppler )
find_library ( LIBPOPPLER_QT4 poppler-qt4 )
find_path ( INCLUDEPOPPLER_QT4 poppler/qt4/poppler-qt4.h )
find_path ( INCLUDEPOPPLER poppler-qt4.h PATHS ${ INCLUDEPOPPLER_QT4 } /poppler/qt4 )
if ( LIBPOPPLER_QT4 AND LIBPOPPLER AND INCLUDEPOPPLER )
set ( POPPLER_FOUND TRUE )
set ( _PopplerLinkFlags ${ LIBPOPPLER } ${ LIBPOPPLER_QT4 } )
set ( POPPLER_INCLUDE_DIR ${ INCLUDEPOPPLER } )
endif ( LIBPOPPLER_QT4 AND LIBPOPPLER AND INCLUDEPOPPLER )
endif ( _PopplerLinkFlags )
endif ( _pc_poppler_FOUND AND _pc_poppler_VERSION VERSION_GREATER 0.5.3 )
else ( NOT WIN32 )
# a s s u m e s o , f o r n o w
set ( POPPLER_FOUND TRUE )
endif ( NOT WIN32 )
if ( POPPLER_FOUND )
# s e t i t b a c k a s f a l s e
set ( POPPLER_FOUND FALSE )
find_library ( POPPLER_LIBRARY poppler-qt4
H I N T S $ { _ p c _ p o p p l e r _ L I B R A R Y _ D I R S }
)
find_path ( POPPLER_INCLUDE_DIR poppler-qt4.h
H I N T S $ { _ p c _ p o p p l e r _ I N C L U D E _ D I R S }
P A T H _ S U F F I X E S p o p p l e r / q t 4
)
find_path ( POPPLER_INCLUDE_DIR_core qt4/poppler-qt4.h
H I N T S $ { _ p c _ p o p p l e r _ I N C L U D E _ D I R S }
P A T H _ S U F F I X E S p o p p l e r
)
if ( POPPLER_LIBRARY AND POPPLER_INCLUDE_DIR AND POPPLER_INCLUDE_DIR_core )
list ( APPEND POPPLER_INCLUDE_DIR "${POPPLER_INCLUDE_DIR_core}" )
set ( POPPLER_FOUND TRUE )
endif ( POPPLER_LIBRARY AND POPPLER_INCLUDE_DIR AND POPPLER_INCLUDE_DIR_core )
endif ( POPPLER_FOUND )
if ( POPPLER_FOUND )
INCLUDE ( CheckCXXSourceCompiles )
set ( POPPLER_LIBRARY ${ _PopplerLinkFlags } )
# t h e c f l a g s f o r p o p p l e r - q t 4 c a n c o n t a i n m o r e t h a n o n e i n c l u d e p a t h
separate_arguments ( _PopplerCflags )
foreach ( _includedir ${ _PopplerCflags } )
string ( REGEX REPLACE "-I(.+)" "\\1" _includedir "${_includedir}" )
set ( POPPLER_INCLUDE_DIR ${ POPPLER_INCLUDE_DIR } ${ _includedir } )
endforeach ( _includedir )
# c h e c k w h e t h e r w e ' r e u s i n g p o p p l e r 0 . 6
set ( CMAKE_REQUIRED_INCLUDES ${ POPPLER_INCLUDE_DIR } ${ QT_INCLUDE_DIR } )
set ( CMAKE_REQUIRED_LIBRARIES ${ POPPLER_LIBRARY } ${ QT_QTCORE_LIBRARY } ${ QT_QTGUI_LIBRARY } ${ QT_QTXML_LIBRARY } )