Commit 8b7dec28 authored by Kyle Auble's avatar Kyle Auble 💬

cmake: Finish making FindGTK more robust

* Add CMake guards to fix #831 and close !605
* Move pkg-config calls to FindGTK & parameterize GTK versions
parent ec878dc5
......@@ -126,6 +126,8 @@ set(TEXTOUT_WORD_LIST ON)
# setting the minimum required versions for some components
set(CAIRO_VERSION "1.10.0")
set(GLIB_REQUIRED "2.41")
set(GTK_REQUIRED "3.8")
set(GDK_PIXBUF_REQUIRED "2.8")
macro_bool_to_01(ENABLE_SPLASH HAVE_SPLASH)
find_package(Freetype REQUIRED)
......
......@@ -16,6 +16,10 @@ include(FindPackageHandleStandardArgs)
find_package(PkgConfig REQUIRED)
pkg_check_modules(GTK3 "gtk+-3.0>=3.8" "gdk-pixbuf-2.0>=2.8")
if(${CMAKE_VERSION} VERSION_LESS "3.6.0")
pkg_check_modules(GTK3 "gtk+-3.0>=${GTK_REQUIRED}" "gdk-pixbuf-2.0>=${GDK_PIXBUF_REQUIRED}")
else()
pkg_check_modules(GTK3 IMPORTED_TARGET "gtk+-3.0>=${GTK_REQUIRED}" "gdk-pixbuf-2.0>=${GDK_PIXBUF_REQUIRED}")
endif()
find_package_handle_standard_args(GTK DEFAULT_MSG GTK3_LIBRARIES GTK3_CFLAGS)
......@@ -27,6 +27,9 @@ set(poppler_glib_demo_SRCS
taggedstruct.c
)
poppler_add_test(poppler-glib-demo BUILD_GTK_TESTS ${poppler_glib_demo_SRCS})
find_package(PkgConfig REQUIRED)
pkg_check_modules(GTK3 REQUIRED IMPORTED_TARGET gtk+-3.0)
target_link_libraries(poppler-glib-demo ${CAIRO_LIBRARIES} poppler-glib PkgConfig::GTK3)
if(${CMAKE_VERSION} VERSION_LESS "3.6.0")
target_link_libraries(poppler-glib-demo ${CAIRO_LIBRARIES} poppler-glib ${GTK3_LIBRARIES})
else()
target_link_libraries(poppler-glib-demo ${CAIRO_LIBRARIES} poppler-glib PkgConfig::GTK3)
endif()
......@@ -13,15 +13,19 @@ set(poppler_check_text_SRCS
check_text.c
)
poppler_add_unittest(poppler-check-text BUILD_GTK_TESTS ${poppler_check_text_SRCS})
find_package(PkgConfig REQUIRED)
pkg_check_modules(GTK3 REQUIRED IMPORTED_TARGET gtk+-3.0)
target_link_libraries(poppler-check-text poppler-glib PkgConfig::GTK3)
set(poppler_check_bb_SRCS
check_bb.c
)
poppler_add_test(poppler-check-bb BUILD_GTK_TESTS ${poppler_check_bb_SRCS})
target_link_libraries(poppler-check-bb poppler-glib PkgConfig::GTK3)
if(${CMAKE_VERSION} VERSION_LESS "3.6.0")
target_link_libraries(poppler-check-text poppler-glib ${GTK3_LIBRARIES})
target_link_libraries(poppler-check-bb poppler-glib ${GTK3_LIBRARIES})
else()
target_link_libraries(poppler-check-text poppler-glib PkgConfig::GTK3)
target_link_libraries(poppler-check-bb poppler-glib PkgConfig::GTK3)
endif()
poppler_add_testcase(poppler-check-bb shapes+attachments.pdf 42.5 42.5 557.5 557.5)
poppler_add_testcase(poppler-check-bb orientation.pdf 34 34 83.74 49 793 34 808 97.19 488.02 793 561 808 34 503.61 49 56)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment