diff options
author | Kyle Auble <kyle.auble@outlook.com> | 2020-10-10 16:51:12 -0400 |
---|---|---|
committer | Kyle Auble <kyle.auble@outlook.com> | 2020-10-16 17:22:29 -0400 |
commit | 8b7dec2843999f8c3d77d921bd58688fbf4ff313 (patch) | |
tree | 2d3884f2ad00f705eb6cbbea84a99740a24b2680 | |
parent | ec878dc540ce84aa010240d4795e2be2c3cc9caf (diff) |
cmake: Finish making FindGTK more robust
* Add CMake guards to fix #831 and close !605
* Move pkg-config calls to FindGTK & parameterize GTK versions
-rw-r--r-- | CMakeLists.txt | 2 | ||||
-rw-r--r-- | cmake/modules/FindGTK.cmake | 6 | ||||
-rw-r--r-- | glib/demo/CMakeLists.txt | 9 | ||||
-rw-r--r-- | glib/tests/CMakeLists.txt | 12 |
4 files changed, 21 insertions, 8 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 3da3fb3b..7487875a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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) diff --git a/cmake/modules/FindGTK.cmake b/cmake/modules/FindGTK.cmake index 3cc78438..5f793aac 100644 --- a/cmake/modules/FindGTK.cmake +++ b/cmake/modules/FindGTK.cmake @@ -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) diff --git a/glib/demo/CMakeLists.txt b/glib/demo/CMakeLists.txt index c3c7e166..5add9ca8 100644 --- a/glib/demo/CMakeLists.txt +++ b/glib/demo/CMakeLists.txt @@ -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() diff --git a/glib/tests/CMakeLists.txt b/glib/tests/CMakeLists.txt index 096de1b8..acac077d 100644 --- a/glib/tests/CMakeLists.txt +++ b/glib/tests/CMakeLists.txt @@ -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) |