Blob Blame History Raw
From e1d3505d4a6743de05a4baf9ec66bfec2f9e5b01 Mon Sep 17 00:00:00 2001
From: jdt141 <justin.d.teems@gmail.com>
Date: Sun, 8 Sep 2013 22:22:06 -0400
Subject: [PATCH] Addition of pkg-config header only file generation for
 geometry lib

---
 cmake/pcl_targets.cmake             | 33 +++++++++++++++++++++++++++++++++
 cmake/pkgconfig-headeronly.cmake.in | 12 ++++++++++++
 geometry/CMakeLists.txt             |  6 +++---
 3 files changed, 48 insertions(+), 3 deletions(-)
 create mode 100644 cmake/pkgconfig-headeronly.cmake.in

diff --git a/cmake/pcl_targets.cmake b/cmake/pcl_targets.cmake
index 8a5e343..1f7c2b5 100644
--- a/cmake/pcl_targets.cmake
+++ b/cmake/pcl_targets.cmake
@@ -454,6 +454,39 @@ macro(PCL_MAKE_PKGCONFIG _name _component _desc _pcl_deps _ext_deps _int_deps _c
         COMPONENT pcl_${_component})
 endmacro(PCL_MAKE_PKGCONFIG)
 
+###############################################################################
+# Make a pkg-config file for a header-only library. 
+# Essentially a duplicate of PCL_MAKE_PKGCONFIG, but 
+# ensures that no -L or l flags will be created
+# Do not include general PCL stuff in the
+# arguments; they will be added automaticaly.
+# _name The library name. "pcl_" will be preprended to this.
+# _component The part of PCL that this pkg-config file belongs to.
+# _desc Description of the library.
+# _pcl_deps External dependencies to pcl libs, as a list. (will get mangled to external pkg-config name)
+# _ext_deps External dependencies, as a list.
+# _int_deps Internal dependencies, as a list.
+# _cflags Compiler flags necessary to build with the library.
+macro(PCL_MAKE_PKGCONFIG_HEADER_ONLY _name _component _desc _pcl_deps _ext_deps _int_deps _cflags)
+set(PKG_NAME ${_name})
+set(PKG_DESC ${_desc})
+set(PKG_CFLAGS ${_cflags})
+#set(PKG_LIBFLAGS ${_lib_flags})
+LIST_TO_STRING(_ext_deps_str "${_ext_deps}")
+set(PKG_EXTERNAL_DEPS ${_ext_deps_str})
+foreach(_dep ${_pcl_deps})
+set(PKG_EXTERNAL_DEPS "${PKG_EXTERNAL_DEPS} pcl_${_dep}-${PCL_MAJOR_VERSION}.${PCL_MINOR_VERSION}")
+endforeach(_dep)
+set(PKG_INTERNAL_DEPS "")
+foreach(_dep ${_int_deps})
+set(PKG_INTERNAL_DEPS "${PKG_INTERNAL_DEPS} -l${_dep}")
+endforeach(_dep)
+set(_pc_file ${CMAKE_CURRENT_BINARY_DIR}/${_name}-${PCL_MAJOR_VERSION}.${PCL_MINOR_VERSION}.pc)
+configure_file(${PROJECT_SOURCE_DIR}/cmake/pkgconfig-headeronly.cmake.in ${_pc_file} @ONLY)
+install(FILES ${_pc_file} DESTINATION ${PKGCFG_INSTALL_DIR}
+COMPONENT pcl_${_component})
+endmacro(PCL_MAKE_PKGCONFIG_HEADER_ONLY)
+
 
 ###############################################################################
 # PRIVATE
diff --git a/cmake/pkgconfig-headeronly.cmake.in b/cmake/pkgconfig-headeronly.cmake.in
new file mode 100644
index 0000000..6359f03
--- /dev/null
+++ b/cmake/pkgconfig-headeronly.cmake.in
@@ -0,0 +1,12 @@
+# This file was generated by CMake for @PROJECT_NAME@ library @PKG_NAME@
+prefix=@CMAKE_INSTALL_PREFIX@
+exec_prefix=${prefix}
+libdir=${prefix}/@LIB_INSTALL_DIR@
+#includedir=${prefix}/@INCLUDE_INSTALL_DIR@
+includedir=${prefix}/include/@PROJECT_NAME_LOWER@-@PCL_MAJOR_VERSION@.@PCL_MINOR_VERSION@
+Name: @PKG_NAME@
+Description: @PKG_DESC@
+Version: @PCL_VERSION@
+Requires: @PKG_EXTERNAL_DEPS@
+Libs: 
+Cflags: -I${includedir} @PKG_CFLAGS@
diff --git a/geometry/CMakeLists.txt b/geometry/CMakeLists.txt
index ec387a6..ec8d9d3 100644
--- a/geometry/CMakeLists.txt
+++ b/geometry/CMakeLists.txt
@@ -37,11 +37,11 @@ if(build)
 #      src/geometry.cpp
 #     )
 
-#  set(LIB_NAME pcl_${SUBSYS_NAME})
+set(LIB_NAME pcl_${SUBSYS_NAME})
   include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include)
-#  PCL_ADD_LIBRARY(${LIB_NAME} ${SUBSYS_NAME} ${srcs} ${incs} ${impl_incs})
+# PCL_ADD_LIBRARY(${LIB_NAME} ${SUBSYS_NAME} ${srcs} ${incs} ${impl_incs})
 #  target_link_libraries(${LIB_NAME} pcl_common)
-#  PCL_MAKE_PKGCONFIG(${LIB_NAME} ${SUBSYS_NAME} "${SUBSYS_DESC}" "${SUBSYS_DEPS}" "" "" "" "")
+PCL_MAKE_PKGCONFIG_HEADER_ONLY(${LIB_NAME} ${SUBSYS_NAME} "${SUBSYS_DESC}" "${SUBSYS_DEPS}" "" "" "")
 
   # Install include files
   PCL_ADD_INCLUDES(${SUBSYS_NAME} ${SUBSYS_NAME} ${incs})
-- 
1.8.4