@ -58,39 +58,41 @@ endif(WITH_ZLIB)
if ( WITH_JPEG )
find_package ( JPEG )
# C h e c k w h e t h e r t h e v e r s i o n o f l i b j p e g w e f o u n d w a s l i b j p e g - t u r b o a n d p r i n t a
# w a r n i n g i f n o t .
set ( CMAKE_REQUIRED_LIBRARIES ${ JPEG_LIBRARIES } )
set ( CMAKE_REQUIRED_FLAGS -I ${ JPEG_INCLUDE_DIR } )
set ( JPEG_TEST_SOURCE " \n
# i n c l u d e < s t d i o . h > \ n
# i n c l u d e < j p e g l i b . h > \ n
i n t main ( void ) { \ n
s t r u c t j p e g _ c o m p r e s s _ s t r u c t c i n f o ; \ n
s t r u c t j p e g _ e r r o r _ m g r j e r r ; \ n
c i n f o . e r r = jpeg_std_error ( &jerr ) ; \ n
jpeg_create_compress ( &cinfo ) ; \ n
c i n f o . i n p u t _ c o m p o n e n t s = 3 ; \ n
jpeg_set_defaults ( &cinfo ) ; \ n
c i n f o . i n _ c o l o r _ s p a c e = J C S _ E X T _ R G B ; \ n
jpeg_default_colorspace ( &cinfo ) ; \ n
r e t u r n 0 ; \ n
} " )
if ( CMAKE_CROSSCOMPILING )
check_c_source_compiles ( "${JPEG_TEST_SOURCE}" FOUND_LIBJPEG_TURBO )
else ( )
check_c_source_runs ( "${JPEG_TEST_SOURCE}" FOUND_LIBJPEG_TURBO )
endif ( )
set ( CMAKE_REQUIRED_LIBRARIES )
set ( CMAKE_REQUIRED_FLAGS )
set ( CMAKE_REQUIRED_DEFINITIONS )
if ( NOT FOUND_LIBJPEG_TURBO )
message ( WARNING "*** The libjpeg library you are building against is not libjpeg-turbo. Performance will be reduced. You can obtain libjpeg-turbo from: https://sourceforge.net/projects/libjpeg-turbo/files/ ***" )
endif ( )
if ( JPEG_FOUND )
# C h e c k w h e t h e r t h e v e r s i o n o f l i b j p e g w e f o u n d w a s l i b j p e g - t u r b o a n d p r i n t a
# w a r n i n g i f n o t .
set ( CMAKE_REQUIRED_LIBRARIES ${ JPEG_LIBRARIES } )
set ( CMAKE_REQUIRED_FLAGS -I ${ JPEG_INCLUDE_DIR } )
set ( JPEG_TEST_SOURCE " \n
# i n c l u d e < s t d i o . h > \ n
# i n c l u d e < j p e g l i b . h > \ n
i n t main ( void ) { \ n
s t r u c t j p e g _ c o m p r e s s _ s t r u c t c i n f o ; \ n
s t r u c t j p e g _ e r r o r _ m g r j e r r ; \ n
c i n f o . e r r = jpeg_std_error ( &jerr ) ; \ n
jpeg_create_compress ( &cinfo ) ; \ n
c i n f o . i n p u t _ c o m p o n e n t s = 3 ; \ n
jpeg_set_defaults ( &cinfo ) ; \ n
c i n f o . i n _ c o l o r _ s p a c e = J C S _ E X T _ R G B ; \ n
jpeg_default_colorspace ( &cinfo ) ; \ n
r e t u r n 0 ; \ n
} " )
if ( CMAKE_CROSSCOMPILING )
check_c_source_compiles ( "${JPEG_TEST_SOURCE}" FOUND_LIBJPEG_TURBO )
else ( )
check_c_source_runs ( "${JPEG_TEST_SOURCE}" FOUND_LIBJPEG_TURBO )
endif ( )
set ( CMAKE_REQUIRED_LIBRARIES )
set ( CMAKE_REQUIRED_FLAGS )
set ( CMAKE_REQUIRED_DEFINITIONS )
if ( NOT FOUND_LIBJPEG_TURBO )
message ( WARNING "*** The libjpeg library you are building against is not libjpeg-turbo. Performance will be reduced. You can obtain libjpeg-turbo from: https://sourceforge.net/projects/libjpeg-turbo/files/ ***" )
endif ( )
endif ( JPEG_FOUND )
endif ( WITH_JPEG )