summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Hein <cthfzvb62g@liamekaens.com>2020-08-03 18:56:20 -0600
committerKyle Auble <kyle.auble@outlook.com>2020-10-16 17:22:22 -0400
commitec878dc540ce84aa010240d4795e2be2c3cc9caf (patch)
tree326ea0fb3096462e0030c36933d9373eeda0980a
parentc67bd3fafe0cff41855b4a2fdf7a3eb98a05ea3e (diff)
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 <kyle.auble@outlook.com>
-rw-r--r--glib/demo/CMakeLists.txt4
-rw-r--r--glib/tests/CMakeLists.txt7
2 files changed, 8 insertions, 3 deletions
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)