Skip to content

Commit

Permalink
dokan_fuse: Add libfuse-compatible pkg-config
Browse files Browse the repository at this point in the history
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 dokan-dev#338.
  • Loading branch information
Rondom committed Oct 22, 2016
1 parent bbf256e commit 9d7a15b
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 0 deletions.
23 changes: 23 additions & 0 deletions dokan_fuse/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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}
Expand Down
13 changes: 13 additions & 0 deletions dokan_fuse/pkg-config.pc.in
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 9d7a15b

Please sign in to comment.