You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@logging.apache.org by ts...@apache.org on 2020/02/09 20:20:11 UTC

[logging-log4cxx] 31/49: Install a pkgconfig file on unix systems

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

tschoening pushed a commit to branch ghpr_14_replace-ant-build-with-cmake
in repository https://gitbox.apache.org/repos/asf/logging-log4cxx.git

commit f1331491386f42bb3673c62bd02e455048bd22cc
Author: Stephen Webb <sw...@gmail.com>
AuthorDate: Sun Feb 2 10:22:20 2020 +1100

    Install a pkgconfig file on unix systems
---
 CMakeLists.txt | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index b37e6e4..0b46e1e 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -38,12 +38,28 @@ install(TARGETS log4cxx EXPORT log4cxxTargets
   LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
   INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
 )
+
 IF(WIN32 AND LOG4CXX_INSTALL_PDB)
   INSTALL(FILES $<TARGET_PDB_FILE:log4cxx>
           DESTINATION ${CMAKE_INSTALL_BINDIR}
           CONFIGURATIONS RelWithDebInfo Debug
   )
-ENDIF()
+ENDIF(WIN32 AND LOG4CXX_INSTALL_PDB)
+
+if(UNIX)
+  set(prefix "${CMAKE_INSTALL_PREFIX}")
+  set(exec_prefix "${CMAKE_INSTALL_PREFIX}")
+  set(libdir "\${prefix}/${CMAKE_INSTALL_LIBDIR}")
+  set(includedir "\${prefix}/${CMAKE_INSTALL_INCLUDEDIR}")
+  set(VERSION "${log4cxx_VERSION_MAJOR}.${log4cxx_VERSION_MINOR}.${log4cxx_VERSION_PATCH}")
+  configure_file("${CMAKE_CURRENT_SOURCE_DIR}/liblog4cxx.pc.in"
+    "${CMAKE_CURRENT_BINARY_DIR}/liblog4cxx.pc"
+  )
+
+  install(FILES "${CMAKE_CURRENT_BINARY_DIR}/liblog4cxx.pc" 
+    DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/pkgconfig)
+endif(UNIX)
+
 
 # create export file which can be imported by other cmake projects
 install(EXPORT log4cxxTargets