From 69e8cc951cdb41cb4d838c73dd1bed522659b47f Mon Sep 17 00:00:00 2001 From: Gary Wang Date: Tue, 23 Jul 2019 17:11:17 +0800 Subject: [PATCH] feat: pkg-config support --- CMakeLists.txt | 4 +++- gio-qt/CMakeLists.txt | 19 ++++++++++++++++++- gio-qt/gio-qt.pc.in | 12 ++++++++++++ 3 files changed, 33 insertions(+), 2 deletions(-) create mode 100644 gio-qt/gio-qt.pc.in diff --git a/CMakeLists.txt b/CMakeLists.txt index 9e029fc..35fe142 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -16,11 +16,13 @@ if (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) set(CMAKE_INSTALL_PREFIX /usr) endif () +include(GNUInstallDirs) + # Find the QtWidgets library find_package(Qt5 ${QT_MINIMUM_VERSION} CONFIG REQUIRED Core) 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) diff --git a/gio-qt/CMakeLists.txt b/gio-qt/CMakeLists.txt index 7ddc5c6..266adbc 100644 --- a/gio-qt/CMakeLists.txt +++ b/gio-qt/CMakeLists.txt @@ -1,5 +1,11 @@ # Populate a CMake variable with the sources # 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 dgiovolumemanager.h dgiomountoperation.h @@ -31,8 +37,19 @@ PUBLIC ${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 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 +) diff --git a/gio-qt/gio-qt.pc.in b/gio-qt/gio-qt.pc.in new file mode 100644 index 0000000..67e2d1b --- /dev/null +++ b/gio-qt/gio-qt.pc.in @@ -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 \ No newline at end of file