feat: pkg-config support

This commit is contained in:
Gary Wang 2019-07-23 17:11:17 +08:00
parent 93e9f529af
commit 69e8cc951c
3 changed files with 33 additions and 2 deletions

View file

@ -16,11 +16,13 @@ if (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
set(CMAKE_INSTALL_PREFIX /usr) set(CMAKE_INSTALL_PREFIX /usr)
endif () endif ()
include(GNUInstallDirs)
# Find the QtWidgets library # Find the QtWidgets library
find_package(Qt5 ${QT_MINIMUM_VERSION} CONFIG REQUIRED Core) find_package(Qt5 ${QT_MINIMUM_VERSION} CONFIG REQUIRED Core)
find_package(PkgConfig) find_package(PkgConfig)
pkg_check_modules(GIOMM giomm-2.4) # look into FindPkgConfig.cmake, pkg_check_modules(GIOMM giomm-2.4) # look into FindPkgConfig.cmake
add_subdirectory (gio-qt) add_subdirectory (gio-qt)

View file

@ -1,5 +1,11 @@
# Populate a CMake variable with the sources # Populate a CMake variable with the sources
# TODO: portable headers? # TODO: portable headers?
# Some custom variables
set(DEST_DIR "${CMAKE_INSTALL_PREFIX}")
CONFIGURE_FILE("gio-qt.pc.in" "gio-qt.pc" @ONLY)
set (QGIO_PUBLIC_HEADER_FILES set (QGIO_PUBLIC_HEADER_FILES
dgiovolumemanager.h dgiovolumemanager.h
dgiomountoperation.h dgiomountoperation.h
@ -31,8 +37,19 @@ PUBLIC
${CMAKE_CURRENT_LIST_DIR} ${CMAKE_CURRENT_LIST_DIR}
) )
target_link_libraries (gio-qt Qt5::Core ${GTKMM_LIBRARIES}) target_link_libraries (gio-qt Qt5::Core ${GIOMM_LIBRARIES})
target_compile_definitions(gio-qt PRIVATE target_compile_definitions(gio-qt PRIVATE
QT_NO_KEYWORDS QT_NO_KEYWORDS
) )
## dev files
install (FILES ${QGIO_PUBLIC_HEADER_FILES}
DESTINATION include/gio-qt
)
install (TARGETS gio-qt DESTINATION lib)
install (FILES "${CMAKE_CURRENT_BINARY_DIR}/gio-qt.pc"
DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig
)

12
gio-qt/gio-qt.pc.in Normal file
View file

@ -0,0 +1,12 @@
prefix=@DEST_DIR@
exec_prefix=${prefix}
libdir=${prefix}/lib
includedir=${prefix}/include
Name: gio-qt
Description: Qt wrapper library for GIO.
Version: 1.0
Requires: glibmm-2.4
Libs: -L${libdir} -lgio-qt
Cflags: -I${includedir} -I{includedir}/gio-qt