From 9d7a15beb9b8666589af583c0e873c6ea255bbcb Mon Sep 17 00:00:00 2001 From: Andreas Gnau Date: Sat, 22 Oct 2016 18:15:12 +0200 Subject: [PATCH] dokan_fuse: Add libfuse-compatible pkg-config Generate a pkg-config-file that can be used as a drop-in "replacement" for libfuse, i.e. $ pkg-config --libs --cflags fuse will return the dokanfuse-flags. Closes #338. --- dokan_fuse/CMakeLists.txt | 23 +++++++++++++++++++++++ dokan_fuse/pkg-config.pc.in | 13 +++++++++++++ 2 files changed, 36 insertions(+) create mode 100644 dokan_fuse/pkg-config.pc.in diff --git a/dokan_fuse/CMakeLists.txt b/dokan_fuse/CMakeLists.txt index 962ba5c7c..41d9fc730 100644 --- a/dokan_fuse/CMakeLists.txt +++ b/dokan_fuse/CMakeLists.txt @@ -14,6 +14,28 @@ include_directories( ${CMAKE_CURRENT_SOURCE_DIR}/../sys ) +# CMake does not have a ternary operator for generator expressions. +# Defining helper-function to deal with setups that manually set an +# absolute path for CMAKE_INSTALL_(LIB|INCLUDE)DIR... +# We could also just make all paths absolute, but this way the +# pkg-config-file is more human-readable +function ( make_pkg_config_absolute out_path in_path ) + if(IS_ABSOLUTE "${${in_path}}") + set(${out_path} "${${in_path}}" PARENT_SCOPE) + else() + set(${out_path} "\${prefix}/${${in_path}}" PARENT_SCOPE) + endif() +endfunction() + +set(pkg_config_file "${CMAKE_CURRENT_BINARY_DIR}/fuse.pc") +make_pkg_config_absolute(PKG_CONFIG_LIBDIR CMAKE_INSTALL_LIBDIR) +make_pkg_config_absolute(PKG_CONFIG_INCLUDEDIR CMAKE_INSTALL_INCLUDEDIR) +CONFIGURE_FILE( + "${CMAKE_CURRENT_SOURCE_DIR}/pkg-config.pc.in" + ${pkg_config_file} + @ONLY +) + file(GLOB sources src/*.cpp src/*.c src/*.rc) set(install_headers include/fuse.h @@ -30,6 +52,7 @@ add_library(dokanfuse1 SHARED ${sources}) INSTALL(FILES ${install_headers} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/fuse/) INSTALL(FILES ${compat_headers} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) +INSTALL(FILES ${pkg_config_file} DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig) INSTALL(TARGETS dokanfuse1 RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} diff --git a/dokan_fuse/pkg-config.pc.in b/dokan_fuse/pkg-config.pc.in new file mode 100644 index 000000000..6ab516f00 --- /dev/null +++ b/dokan_fuse/pkg-config.pc.in @@ -0,0 +1,13 @@ +prefix=@CMAKE_INSTALL_PREFIX@ +exec_prefix=${prefix} +libdir=@PKG_CONFIG_LIBDIR@ +includedir=@PKG_CONFIG_INCLUDEDIR@ + +Name: Dokan FUSE +Description: FUSE-API compatibility library for the Dokan user mode filesystem driver for Windows +# We are providing compatibility with libfuse 2.6.x. +# Since this is fuse.pc, we report the corresponding libfuse-version +Version: 2.6.0 +URL: https://dokan-dev.github.io +Libs: -L${libdir} -l@PROJECT_NAME@ +Cflags: -I${includedir} -D_FILE_OFFSET_BITS=64