This is an automated email from the ASF dual-hosted git repository.

jking pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/thrift.git


The following commit(s) were added to refs/heads/master by this push:
     new 1231930  THRIFT-4760: Configure and install pkgconfig files when using 
cmake Client: cpp
1231930 is described below

commit 1231930abd1d72b422deec967559caf3dc02dac7
Author: Joel 'Aaron' Cohen <joel.co...@nrl.navy.mil>
AuthorDate: Fri Jan 25 10:42:54 2019 -0500

    THRIFT-4760: Configure and install pkgconfig files when using cmake
    Client: cpp
---
 build/cmake/DefineInstallationPaths.cmake | 5 +++++
 build/cmake/ThriftMacros.cmake            | 7 +++++++
 lib/cpp/CMakeLists.txt                    | 4 ++++
 3 files changed, 16 insertions(+)

diff --git a/build/cmake/DefineInstallationPaths.cmake 
b/build/cmake/DefineInstallationPaths.cmake
index 122f0f6..d9a7174 100644
--- a/build/cmake/DefineInstallationPaths.cmake
+++ b/build/cmake/DefineInstallationPaths.cmake
@@ -23,4 +23,9 @@ set(BIN_INSTALL_DIR "bin" CACHE PATH "The binary install dir 
(default: bin)")
 set(LIB_INSTALL_DIR "lib${LIB_SUFFIX}" CACHE PATH "The library install dir 
(default: lib${LIB_SUFFIX})")
 set(INCLUDE_INSTALL_DIR "include" CACHE PATH "The library install dir 
(default: include)")
 set(CMAKE_INSTALL_DIR "cmake" CACHE PATH "The subdirectory to install cmake 
config files (default: cmake)")
+set(PKGCONFIG_INSTALL_DIR "lib/pkgconfig" CACHE PATH "The subdirectory to 
install pkgconfig config files (default: lib/pkgconfig)")
 set(DOC_INSTALL_DIR "share/doc" CACHE PATH "The subdirectory to install 
documentation files (default: share/doc)")
+set(prefix "${CMAKE_INSTALL_PREFIX}")
+set(exec_prefix "${CMAKE_INSTALL_PREFIX}/bin")
+set(libdir "${CMAKE_INSTALL_PREFIX}/lib")
+set(includedir "${CMAKE_INSTALL_PREFIX}/include")
diff --git a/build/cmake/ThriftMacros.cmake b/build/cmake/ThriftMacros.cmake
index 366719f..8f370df 100644
--- a/build/cmake/ThriftMacros.cmake
+++ b/build/cmake/ThriftMacros.cmake
@@ -17,6 +17,13 @@
 # under the License.
 #
 
+macro(ADD_PKGCONFIG_THRIFT name)
+    configure_file("${name}.pc.in" "${CMAKE_CURRENT_BINARY_DIR}/${name}.pc" 
@ONLY)
+    install(FILES "${CMAKE_CURRENT_BINARY_DIR}/${name}.pc"
+        DESTINATION "${PKGCONFIG_INSTALL_DIR}")
+endmacro(ADD_PKGCONFIG_THRIFT)
+
+
 macro(ADD_LIBRARY_THRIFT name)
     add_library(${name} ${ARGN})
     set_target_properties(${name} PROPERTIES
diff --git a/lib/cpp/CMakeLists.txt b/lib/cpp/CMakeLists.txt
index f4e8104..dd90c80 100755
--- a/lib/cpp/CMakeLists.txt
+++ b/lib/cpp/CMakeLists.txt
@@ -144,6 +144,7 @@ if(WIN32)
 else()
     TARGET_LINK_LIBRARIES_THRIFT(thrift ${SYSLIBS})
 endif()
+ADD_PKGCONFIG_THRIFT(thrift)
 
 if(WITH_LIBEVENT)
     find_package(Libevent REQUIRED)  # Libevent comes with CMake support form 
upstream
@@ -152,6 +153,7 @@ if(WITH_LIBEVENT)
     ADD_LIBRARY_THRIFT(thriftnb ${thriftcppnb_SOURCES})
     LINK_AGAINST_THRIFT_LIBRARY(thriftnb thrift)
     TARGET_LINK_LIBRARIES_THRIFT(thriftnb ${SYSLIBS} ${LIBEVENT_LIBRARIES})
+    ADD_PKGCONFIG_THRIFT(thrift-nb)
 endif()
 
 if(WITH_ZLIB)
@@ -161,10 +163,12 @@ if(WITH_ZLIB)
     ADD_LIBRARY_THRIFT(thriftz ${thriftcppz_SOURCES})
     TARGET_LINK_LIBRARIES_THRIFT(thriftz ${SYSLIBS} ${ZLIB_LIBRARIES})
     TARGET_LINK_LIBRARIES_THRIFT_AGAINST_THRIFT_LIBRARY(thriftz thrift)
+    ADD_PKGCONFIG_THRIFT(thrift-z)
 endif()
 
 if(WITH_QT5)
     add_subdirectory(src/thrift/qt)
+    ADD_PKGCONFIG_THRIFT(thrift-qt5)
 endif()
 
 if(MSVC)

Reply via email to