Commit 67c3878e authored by Emilio Pozuelo Monfort's avatar Emilio Pozuelo Monfort Committed by Albert Astals Cid

cmake: support GNUInstallDirs

This allows users to set various install directories, e.g.
libdir, includedir, mandir...

Bug #103211
parent 4d109589
......@@ -22,6 +22,8 @@ test_big_endian(WORDS_BIGENDIAN)
include(CheckFileOffsetBits)
CHECK_FILE_OFFSET_BITS()
include(GNUInstallDirs)
find_package (ECM 1.6.0 QUIET NO_MODULE)
if (ECM_FOUND)
include("${ECM_MODULE_DIR}/ECMEnableSanitizers.cmake")
......@@ -65,9 +67,6 @@ else()
endif()
option(EXTRA_WARN "Enable extra compile warnings" OFF)
set(LIB_SUFFIX "" CACHE STRING "Define suffix of directory name (32/64)")
set(SHARE_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/share" CACHE STRING "Share directory name")
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
set(TESTDATADIR "${CMAKE_SOURCE_DIR}/../test" CACHE STRING "Specify test data dir.")
......@@ -550,7 +549,7 @@ target_link_libraries(poppler LINK_PRIVATE ${poppler_LIBS})
if(CMAKE_USE_PTHREADS_INIT)
target_link_libraries(poppler LINK_PRIVATE Threads::Threads)
endif()
install(TARGETS poppler RUNTIME DESTINATION bin LIBRARY DESTINATION lib${LIB_SUFFIX} ARCHIVE DESTINATION lib${LIB_SUFFIX})
install(TARGETS poppler RUNTIME DESTINATION bin LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
if(ENABLE_XPDF_HEADERS)
install(FILES
......@@ -746,24 +745,24 @@ else()
set(PC_REQUIRES_PRIVATE "")
endif()
poppler_create_install_pkgconfig(poppler.pc lib${LIB_SUFFIX}/pkgconfig)
poppler_create_install_pkgconfig(poppler.pc ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
if(ENABLE_SPLASH)
poppler_create_install_pkgconfig(poppler-splash.pc lib${LIB_SUFFIX}/pkgconfig)
poppler_create_install_pkgconfig(poppler-splash.pc ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
endif()
if(ENABLE_QT4)
poppler_create_install_pkgconfig(poppler-qt4.pc lib${LIB_SUFFIX}/pkgconfig)
poppler_create_install_pkgconfig(poppler-qt4.pc ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
endif()
if(ENABLE_QT5)
poppler_create_install_pkgconfig(poppler-qt5.pc lib${LIB_SUFFIX}/pkgconfig)
poppler_create_install_pkgconfig(poppler-qt5.pc ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
endif()
if(ENABLE_GLIB)
poppler_create_install_pkgconfig(poppler-glib.pc lib${LIB_SUFFIX}/pkgconfig)
poppler_create_install_pkgconfig(poppler-glib.pc ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
endif()
if(CAIRO_FOUND)
poppler_create_install_pkgconfig(poppler-cairo.pc lib${LIB_SUFFIX}/pkgconfig)
poppler_create_install_pkgconfig(poppler-cairo.pc ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
endif()
if(ENABLE_CPP)
poppler_create_install_pkgconfig(poppler-cpp.pc lib${LIB_SUFFIX}/pkgconfig)
poppler_create_install_pkgconfig(poppler-cpp.pc ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
endif()
......
......@@ -72,7 +72,7 @@ macro(gir_add_introspections introspections_girs)
VERBATIM
)
list(APPEND _gir_girs ${CMAKE_CURRENT_BINARY_DIR}/${gir})
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${gir} DESTINATION ${SHARE_INSTALL_DIR}/gir-1.0)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${gir} DESTINATION ${CMAKE_INSTALL_DATADIR}/gir-1.0)
string(REPLACE ".gir" ".typelib" _typelib "${gir}")
add_custom_command(
......@@ -86,7 +86,7 @@ macro(gir_add_introspections introspections_girs)
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
)
list(APPEND _gir_typelibs ${CMAKE_CURRENT_BINARY_DIR}/${_typelib})
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${_typelib} DESTINATION lib${LIB_SUFFIX}/girepository-1.0)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${_typelib} DESTINATION ${CMAKE_INSTALL_LIBDIR}/girepository-1.0)
endforeach()
......
......@@ -25,7 +25,7 @@ set(poppler_cpp_SRCS
add_library(poppler-cpp SHARED ${poppler_cpp_SRCS})
set_target_properties(poppler-cpp PROPERTIES VERSION 0.3.0 SOVERSION 0)
target_link_libraries(poppler-cpp poppler ${ICONV_LIBRARIES})
install(TARGETS poppler-cpp RUNTIME DESTINATION bin LIBRARY DESTINATION lib${LIB_SUFFIX} ARCHIVE DESTINATION lib${LIB_SUFFIX})
install(TARGETS poppler-cpp RUNTIME DESTINATION bin LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
install(FILES
poppler-document.h
......
......@@ -86,7 +86,7 @@ target_link_libraries(poppler-glib poppler ${GLIB2_LIBRARIES} ${CAIRO_LIBRARIES}
if(CMAKE_USE_PTHREADS_INIT)
target_link_libraries(poppler-glib Threads::Threads)
endif()
install(TARGETS poppler-glib RUNTIME DESTINATION bin LIBRARY DESTINATION lib${LIB_SUFFIX} ARCHIVE DESTINATION lib${LIB_SUFFIX})
install(TARGETS poppler-glib RUNTIME DESTINATION bin LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
install(FILES
${poppler_glib_public_headers}
......
......@@ -8,5 +8,5 @@ add_custom_command(
add_custom_target(glib-docs ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/glib-docs-build.stamp)
install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/html/
DESTINATION "${SHARE_INSTALL_DIR}/gtk-doc/html/poppler"
DESTINATION "${CMAKE_INSTALL_DATADIR}/gtk-doc/html/poppler"
)
prefix=@CMAKE_INSTALL_PREFIX@
exec_prefix=${prefix}
libdir=${exec_prefix}/lib@LIB_SUFFIX@
includedir=${prefix}/include
libdir=@CMAKE_INSTALL_LIBDIR@
includedir=@CMAKE_INSTALL_INCLUDEDIR@
Name: poppler-cairo
Description: Cairo backend for Poppler PDF rendering library
......
prefix=@CMAKE_INSTALL_PREFIX@
exec_prefix=${prefix}
libdir=${exec_prefix}/lib@LIB_SUFFIX@
includedir=${prefix}/include
libdir=@CMAKE_INSTALL_LIBDIR@
includedir=@CMAKE_INSTALL_INCLUDEDIR@
Name: poppler-cpp
Description: cpp backend for Poppler PDF rendering library
......
prefix=@CMAKE_INSTALL_PREFIX@
exec_prefix=${prefix}
libdir=${exec_prefix}/lib@LIB_SUFFIX@
includedir=${prefix}/include
libdir=@CMAKE_INSTALL_LIBDIR@
includedir=@CMAKE_INSTALL_INCLUDEDIR@
Name: poppler-glib
Description: GLib wrapper for poppler
......
prefix=@CMAKE_INSTALL_PREFIX@
exec_prefix=${prefix}
libdir=${exec_prefix}/lib@LIB_SUFFIX@
includedir=${prefix}/include
libdir=@CMAKE_INSTALL_LIBDIR@
includedir=@CMAKE_INSTALL_INCLUDEDIR@
Name: poppler-qt4
Description: Qt4 bindings for poppler
......
prefix=@CMAKE_INSTALL_PREFIX@
exec_prefix=${prefix}
libdir=${exec_prefix}/lib@LIB_SUFFIX@
includedir=${prefix}/include
libdir=CMAKE_INSTALL_LIBDIR@
includedir=@CMAKE_INSTALL_INCLUDEDIR@
Name: poppler-qt5
Description: Qt5 bindings for poppler
......
prefix=@CMAKE_INSTALL_PREFIX@
exec_prefix=${prefix}
libdir=${exec_prefix}/lib@LIB_SUFFIX@
includedir=${prefix}/include
libdir=@CMAKE_INSTALL_LIBDIR@
includedir=@CMAKE_INSTALL_INCLUDEDIR@
Name: poppler-splash
Description: Splash backend for Poppler PDF rendering library
......
prefix=@CMAKE_INSTALL_PREFIX@
exec_prefix=${prefix}
libdir=${exec_prefix}/lib@LIB_SUFFIX@
includedir=${prefix}/include
libdir=@CMAKE_INSTALL_LIBDIR@
includedir=@CMAKE_INSTALL_INCLUDEDIR@
Name: poppler
Description: PDF rendering library
......
......@@ -35,7 +35,7 @@ target_link_libraries(poppler-qt4 poppler ${QT4_QTCORE_LIBRARY} ${QT4_QTGUI_LIBR
if(MSVC)
target_link_libraries(poppler-qt4 poppler ${poppler_LIBS})
endif()
install(TARGETS poppler-qt4 RUNTIME DESTINATION bin LIBRARY DESTINATION lib${LIB_SUFFIX} ARCHIVE DESTINATION lib${LIB_SUFFIX})
install(TARGETS poppler-qt4 RUNTIME DESTINATION bin LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
install(FILES
poppler-qt4.h
......
......@@ -35,7 +35,7 @@ target_link_libraries(poppler-qt5 poppler ${Qt5Core_LIBRARIES} ${Qt5Gui_LIBRARIE
if(MSVC)
target_link_libraries(poppler-qt5 poppler ${poppler_LIBS})
endif()
install(TARGETS poppler-qt5 RUNTIME DESTINATION bin LIBRARY DESTINATION lib${LIB_SUFFIX} ARCHIVE DESTINATION lib${LIB_SUFFIX})
install(TARGETS poppler-qt5 RUNTIME DESTINATION bin LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
install(FILES
poppler-qt5.h
......
......@@ -14,7 +14,7 @@ if (ENABLE_SPLASH)
add_executable(pdftoppm ${pdftoppm_SOURCES})
target_link_libraries(pdftoppm ${common_libs})
install(TARGETS pdftoppm DESTINATION bin)
install(FILES pdftoppm.1 DESTINATION ${SHARE_INSTALL_DIR}/man/man1)
install(FILES pdftoppm.1 DESTINATION ${CMAKE_INSTALL_MANDIR}/man1)
endif ()
if (HAVE_CAIRO)
......@@ -44,7 +44,7 @@ if (HAVE_CAIRO)
target_link_libraries(pdftocairo ${LCMS2_LIBRARIES})
endif()
install(TARGETS pdftocairo DESTINATION bin)
install(FILES pdftocairo.1 DESTINATION ${SHARE_INSTALL_DIR}/man/man1)
install(FILES pdftocairo.1 DESTINATION ${CMAKE_INSTALL_MANDIR}/man1)
endif ()
# pdfdetach
......@@ -54,7 +54,7 @@ set(pdfdetach_SOURCES ${common_srcs}
add_executable(pdfdetach ${pdfdetach_SOURCES})
target_link_libraries(pdfdetach ${common_libs})
install(TARGETS pdfdetach DESTINATION bin)
install(FILES pdfdetach.1 DESTINATION ${SHARE_INSTALL_DIR}/man/man1)
install(FILES pdfdetach.1 DESTINATION ${CMAKE_INSTALL_MANDIR}/man1)
# pdffonts
set(pdffonts_SOURCES ${common_srcs}
......@@ -63,7 +63,7 @@ set(pdffonts_SOURCES ${common_srcs}
add_executable(pdffonts ${pdffonts_SOURCES})
target_link_libraries(pdffonts ${common_libs})
install(TARGETS pdffonts DESTINATION bin)
install(FILES pdffonts.1 DESTINATION ${SHARE_INSTALL_DIR}/man/man1)
install(FILES pdffonts.1 DESTINATION ${CMAKE_INSTALL_MANDIR}/man1)
# pdfimages
set(pdfimages_SOURCES ${common_srcs}
......@@ -76,7 +76,7 @@ set(pdfimages_SOURCES ${common_srcs}
add_executable(pdfimages ${pdfimages_SOURCES})
target_link_libraries(pdfimages ${common_libs})
install(TARGETS pdfimages DESTINATION bin)
install(FILES pdfimages.1 DESTINATION ${SHARE_INSTALL_DIR}/man/man1)
install(FILES pdfimages.1 DESTINATION ${CMAKE_INSTALL_MANDIR}/man1)
# pdfinfo
set(pdfinfo_SOURCES ${common_srcs}
......@@ -87,7 +87,7 @@ set(pdfinfo_SOURCES ${common_srcs}
add_executable(pdfinfo ${pdfinfo_SOURCES})
target_link_libraries(pdfinfo ${common_libs})
install(TARGETS pdfinfo DESTINATION bin)
install(FILES pdfinfo.1 DESTINATION ${SHARE_INSTALL_DIR}/man/man1)
install(FILES pdfinfo.1 DESTINATION ${CMAKE_INSTALL_MANDIR}/man1)
if (ENABLE_NSS3)
# pdfsig
......@@ -106,7 +106,7 @@ set(pdftops_SOURCES ${common_srcs}
add_executable(pdftops ${pdftops_SOURCES})
target_link_libraries(pdftops ${common_libs})
install(TARGETS pdftops DESTINATION bin)
install(FILES pdftops.1 DESTINATION ${SHARE_INSTALL_DIR}/man/man1)
install(FILES pdftops.1 DESTINATION ${CMAKE_INSTALL_MANDIR}/man1)
# pdftotext
set(pdftotext_SOURCES ${common_srcs}
......@@ -115,7 +115,7 @@ set(pdftotext_SOURCES ${common_srcs}
add_executable(pdftotext ${pdftotext_SOURCES})
target_link_libraries(pdftotext ${common_libs})
install(TARGETS pdftotext DESTINATION bin)
install(FILES pdftotext.1 DESTINATION ${SHARE_INSTALL_DIR}/man/man1)
install(FILES pdftotext.1 DESTINATION ${CMAKE_INSTALL_MANDIR}/man1)
# pdftohtml
set(pdftohtml_SOURCES ${common_srcs}
......@@ -127,7 +127,7 @@ set(pdftohtml_SOURCES ${common_srcs}
add_executable(pdftohtml ${pdftohtml_SOURCES})
target_link_libraries(pdftohtml ${common_libs})
install(TARGETS pdftohtml DESTINATION bin)
install(FILES pdftohtml.1 DESTINATION ${SHARE_INSTALL_DIR}/man/man1)
install(FILES pdftohtml.1 DESTINATION ${CMAKE_INSTALL_MANDIR}/man1)
# pdfseparate
set(pdfseparate_SOURCES ${common_srcs}
......@@ -136,7 +136,7 @@ set(pdfseparate_SOURCES ${common_srcs}
add_executable(pdfseparate ${pdfseparate_SOURCES})
target_link_libraries(pdfseparate ${common_libs})
install(TARGETS pdfseparate DESTINATION bin)
install(FILES pdfseparate.1 DESTINATION ${SHARE_INSTALL_DIR}/man/man1)
install(FILES pdfseparate.1 DESTINATION ${CMAKE_INSTALL_MANDIR}/man1)
# pdfunite
set(pdfunite_SOURCES ${common_srcs}
......@@ -145,4 +145,4 @@ set(pdfunite_SOURCES ${common_srcs}
add_executable(pdfunite ${pdfunite_SOURCES})
target_link_libraries(pdfunite ${common_libs})
install(TARGETS pdfunite DESTINATION bin)
install(FILES pdfunite.1 DESTINATION ${SHARE_INSTALL_DIR}/man/man1)
install(FILES pdfunite.1 DESTINATION ${CMAKE_INSTALL_MANDIR}/man1)
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