Skip to content

Commit

Permalink
add pkg-config support
Browse files Browse the repository at this point in the history
  • Loading branch information
ahoarau authored and sztomi committed Oct 25, 2017
1 parent a9a76c7 commit 1630a8d
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
20 changes: 20 additions & 0 deletions CMakeLists.txt
Expand Up @@ -400,6 +400,26 @@ install(FILES
${CMAKE_CURRENT_BINARY_DIR}/cmake/rpclibConfigVersion.cmake
DESTINATION ${CONFIG_PACKAGE_LOCATION}
)

################################################################################
#
# Pkg-config
#
################################################################################
if(NOT MSVC) # Don't install pkg-config files when building with MSVC
# Variables for pkg-config files
set(prefix "${CMAKE_INSTALL_PREFIX}")
set(exec_prefix "")
set(libdir "${CMAKE_INSTALL_PREFIX}/lib")
set(includedir "${CMAKE_INSTALL_PREFIX}/include")
set(rpclib_version ${RPCLIB_VERSION_MAJOR}.${RPCLIB_VERSION_MINOR}.${RPCLIB_VERSION_PATCH})
get_target_property(rpclib_cflags ${OUTPUT_LIBRARY_NAME} COMPILE_OPTIONS)
string(REPLACE ";" " " rpclib_cflags "${rpclib_cflags}") # Convert list to string

configure_file(rpclib.pc.in "${CMAKE_CURRENT_BINARY_DIR}/rpclib.pc" @ONLY)
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/rpclib.pc" DESTINATION "${libdir}/pkgconfig")
endif()

################################################################################
#
# CPack
Expand Down
10 changes: 10 additions & 0 deletions rpclib.pc.in
@@ -0,0 +1,10 @@
prefix=@prefix@
exec_prefix=@exec_prefix@
libdir=@libdir@
includedir=@includedir@

Name: rpclib
Description: rpclib is a msgpack-rpc library written using modern C++
Version: @rpclib_version@
Libs: -L${libdir} -l@OUTPUT_LIBRARY_NAME@
Cflags: -I${includedir} @rpclib_cflags@

0 comments on commit 1630a8d

Please sign in to comment.