Skip to content

Commit 3cbc66a

Browse files
committed
use find_package
1 parent 1f627f6 commit 3cbc66a

File tree

1 file changed

+20
-55
lines changed

1 file changed

+20
-55
lines changed

pdf2htmlEX/CMakeLists.txt

Lines changed: 20 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -21,66 +21,31 @@ add_custom_target(dist
2121
| bzip2 > ${CMAKE_BINARY_DIR}/${ARCHIVE_NAME}.tar.bz2
2222
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
2323

24-
find_package(PkgConfig)
25-
26-
27-
# SINCE we have a very intimate relationship with a particular version of
28-
# poppler... we explicitly describe the poppler include and library
29-
# paths.
30-
#
31-
include_directories(
32-
../poppler/build/poppler
33-
../poppler/build
34-
../poppler/poppler
35-
../poppler
36-
)
37-
#
38-
# The following order is critical as the glib functions use functions
39-
# located in the main poppler library
40-
#
41-
set(POPPLER_LIBRARIES ${POPPLER_LIBRARIES}
42-
${CMAKE_SOURCE_DIR}/../poppler/build/glib/libpoppler-glib.a
43-
${CMAKE_SOURCE_DIR}/../poppler/build/libpoppler.a
24+
find_package(poppler REQUIRED)
25+
set(PDF2HTMLEX_LIBS
26+
${PDF2HTMLEX_LIBS}
27+
poppler::libpoppler
28+
poppler::libpoppler-cpp
29+
poppler::libpoppler-splash
30+
poppler::libpoppler-cairo
31+
poppler::libpoppler-glib
4432
)
4533

46-
4734
if(ENABLE_SVG)
48-
pkg_check_modules(CAIRO REQUIRED cairo>=1.10.0)
49-
message("-- Trying to locate cairo-svg...")
50-
find_path(CAIRO_SVG_INCLUDE_PATH cairo-svg.h PATHS ${CAIRO_INCLUDE_DIRS} NO_DEFAULT_PATH)
51-
if(CAIRO_SVG_INCLUDE_PATH)
52-
message("-- found cairo-svg...")
53-
include_directories(${CAIRO_INCLUDE_DIRS})
54-
if(NOT DEFINED ENV{USING_BREW})
55-
link_directories(${CAIRO_LIBRARY_DIRS})
56-
set(PDF2HTMLEX_LIBS ${PDF2HTMLEX_LIBS} ${CAIRO_LIBRARIES})
57-
endif()
58-
set(ENABLE_SVG 1)
59-
else()
60-
message(FATAL_ERROR "Error: no SVG support found in Cairo")
61-
endif()
62-
63-
find_package(Freetype REQUIRED)
64-
include_directories(${FREETYPE_INCLUDE_DIRS})
65-
link_directories(${FREETYPE_LIBRARY_DIRS})
66-
# set(PDF2HTMLEX_LIBS ${PDF2HTMLEX_LIBS} ${FREETYPE_LIBRARIES})
35+
find_package(cairo REQUIRED)
36+
find_package(freetype REQUIRED)
37+
set(PDF2HTMLEX_LIBS
38+
${PDF2HTMLEX_LIBS}
39+
cairo::cairo-svg
40+
Freetype::Freetype
41+
)
42+
set(ENABLE_SVG 1)
6743
endif()
6844

69-
# SINCE we have a very intimate relationship with a particular version of
70-
# fontforge... we explicitly describe the fontforge include and library
71-
# paths.
72-
#
73-
include_directories(
74-
../fontforge/fontforge
75-
../fontforge
76-
../fontforge/build/inc
77-
../fontforge/inc
78-
)
79-
#
80-
include_directories(${FONTFORGE_INCLUDE_DIRS})
81-
link_directories(${FONTFORGE_LIBRARY_DIRS})
82-
set(FONTFORGE_LIBRARIES ${FONTFORGE_LIBRARIES}
83-
${CMAKE_SOURCE_DIR}/../fontforge/build/lib/libfontforge.a
45+
find_package(fontforge REQUIRED)
46+
set(PDF2HTMLEX_LIBS
47+
${PDF2HTMLEX_LIBS}
48+
fontforge::fontforge
8449
)
8550

8651
# If we are using Alpine Linux then we need to add -lintl

0 commit comments

Comments
 (0)