CMakeLists.txt | 2 ++ cmake/modules/FindGTK.cmake | 6 +++++- glib/CMakeLists.txt | 14 +++----------- glib/demo/CMakeLists.txt | 7 ++++++- glib/tests/CMakeLists.txt | 11 +++++++++-- 5 files changed, 25 insertions(+), 15 deletions(-)
New commits: commit 2fd2acd7f0e5710b8e7b1138b519549e7f3d6750 Author: Kyle Auble <[email protected]> Date: Fri Oct 16 17:18:42 2020 -0400 cmake: Deduplicate _list_prefix macro The macro is only used after an identical version (_gir_list_prefix) is included with GObjectIntrospectionMacros. diff --git a/glib/CMakeLists.txt b/glib/CMakeLists.txt index fd76b150..f0aaf990 100644 --- a/glib/CMakeLists.txt +++ b/glib/CMakeLists.txt @@ -115,14 +115,6 @@ set_directory_properties(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES "${CMAKE_CURRENT_BINARY_DIR}/poppler-enums.h ${CMAKE_CURRENT_BINARY_DIR}/poppler-enums.c" ) - -macro(_list_prefix _outvar _listvar _prefix) - set(${_outvar}) - foreach(_item IN LISTS ${_listvar}) - list(APPEND ${_outvar} ${_prefix}${_item}) - endforeach() -endmacro(_list_prefix) - # GObject Introspection if (HAVE_INTROSPECTION AND BUILD_SHARED_LIBS) include(GObjectIntrospectionMacros) @@ -141,7 +133,7 @@ if (HAVE_INTROSPECTION AND BUILD_SHARED_LIBS) # Format list of include directories as compiler flags get_directory_property(_tmp_includes INCLUDE_DIRECTORIES) - _list_prefix(_includes _tmp_includes "-I") + _gir_list_prefix(_includes _tmp_includes "-I") # And set flags for gir compiler and scanner set(Poppler_0_18_gir_CFLAGS ${_includes} -L${CMAKE_BINARY_DIR} -L${CMAKE_CURRENT_BINARY_DIR}) set(Poppler_0_18_gir_SCANNERFLAGS "--c-include=poppler.h") @@ -150,8 +142,8 @@ if (HAVE_INTROSPECTION AND BUILD_SHARED_LIBS) set(orig_introspect_srcs ${poppler_glib_SRCS} ${poppler_glib_public_headers}) set(gen_introspect_srcs "poppler-enums.c" "poppler-enums.h" "poppler-features.h") # Prefix the files with their correct directories for full paths - _list_prefix(_orig_introspect_paths orig_introspect_srcs "${CMAKE_CURRENT_SOURCE_DIR}/") - _list_prefix(_gen_introspect_paths gen_introspect_srcs "${CMAKE_CURRENT_BINARY_DIR}/") + _gir_list_prefix(_orig_introspect_paths orig_introspect_srcs "${CMAKE_CURRENT_SOURCE_DIR}/") + _gir_list_prefix(_gen_introspect_paths gen_introspect_srcs "${CMAKE_CURRENT_BINARY_DIR}/") # Now load them to the final file list set(Poppler_0_18_gir_FILES ${_orig_introspect_paths} ${_gen_introspect_paths}) commit 8b7dec2843999f8c3d77d921bd58688fbf4ff313 Author: Kyle Auble <[email protected]> Date: Sat Oct 10 16:51:12 2020 -0400 cmake: Finish making FindGTK more robust * Add CMake guards to fix #831 and close !605 * Move pkg-config calls to FindGTK & parameterize GTK versions 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) commit ec878dc540ce84aa010240d4795e2be2c3cc9caf Author: John Hein <[email protected]> Date: Mon Aug 3 18:56:20 2020 -0600 cmake: Fix linker error when gtk is not in a default location Fix the following error when libgtk-3 (et. al.) is not installed in a directory that is not a linker default location: /usr/bin/ld: cannot find -lgtk-3 This change leverages pkg-config to add -L paths as well as the list of gtk3 libraries (-lgtk-3, etc.) Signed-off-by: Kyle Auble <[email protected]> diff --git a/glib/demo/CMakeLists.txt b/glib/demo/CMakeLists.txt index aa705b0f..c3c7e166 100644 --- a/glib/demo/CMakeLists.txt +++ b/glib/demo/CMakeLists.txt @@ -27,4 +27,6 @@ set(poppler_glib_demo_SRCS taggedstruct.c ) poppler_add_test(poppler-glib-demo BUILD_GTK_TESTS ${poppler_glib_demo_SRCS}) -target_link_libraries(poppler-glib-demo ${CAIRO_LIBRARIES} poppler-glib ${GTK3_LIBRARIES}) +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) diff --git a/glib/tests/CMakeLists.txt b/glib/tests/CMakeLists.txt index ee3dbb44..096de1b8 100644 --- a/glib/tests/CMakeLists.txt +++ b/glib/tests/CMakeLists.txt @@ -13,13 +13,16 @@ set(poppler_check_text_SRCS check_text.c ) poppler_add_unittest(poppler-check-text BUILD_GTK_TESTS ${poppler_check_text_SRCS}) -target_link_libraries(poppler-check-text poppler-glib ${GTK3_LIBRARIES}) +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 ${GTK3_LIBRARIES}) +target_link_libraries(poppler-check-bb poppler-glib PkgConfig::GTK3) + 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) poppler_add_testcase(poppler-check-bb xr01.pdf 148.71 126.35 308.11 704.57) _______________________________________________ poppler mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/poppler
