[Liblas-commits] hg: initial try at pkgconfig file creation

liblas-commits at liblas.org liblas-commits at liblas.org
Thu Dec 30 15:39:59 EST 2010


details:   http://hg.liblas.orghg/rev/69dc39deaffd
changeset: 2662:69dc39deaffd
user:      eh3
date:      Thu Dec 30 15:38:56 2010 -0500
description:
initial try at pkgconfig file creation

diffstat:

 CMakeLists.txt      |   4 ++++
 apps/CMakeLists.txt |  48 ++++++++++++++++++++++++++++++++++++++----------
 2 files changed, 42 insertions(+), 10 deletions(-)

diffs (73 lines):

diff -r 7a7830bb543e -r 69dc39deaffd CMakeLists.txt
--- a/CMakeLists.txt	Thu Dec 30 11:32:21 2010 -0600
+++ b/CMakeLists.txt	Thu Dec 30 15:38:56 2010 -0500
@@ -52,6 +52,10 @@
 set(WITH_UTILITIES TRUE CACHE BOOL "Choose if libLAS utilities should be built")
 set(WITH_TESTS TRUE CACHE BOOL "Choose if libLAS unit tests should be built")
 
+# Choose to use pkg-config or not
+set(WITH_PKGCONFIG FALSE CACHE BOOL
+  "Choose whether a pkgconfig file (libLAS.pc) should be installed")
+
 # Enable CTest and submissions to libLAS dashboard at CDash
 # http://my.cdash.org/index.php?project=libLAS
 set(ENABLE_CTEST FALSE CACHE BOOL
diff -r 7a7830bb543e -r 69dc39deaffd apps/CMakeLists.txt
--- a/apps/CMakeLists.txt	Thu Dec 30 11:32:21 2010 -0600
+++ b/apps/CMakeLists.txt	Thu Dec 30 15:38:56 2010 -0500
@@ -188,17 +188,45 @@
 
 if(UNIX)
 
-  # Autoconf compatibility variables to use the same script source.
-  set(prefix ${CMAKE_INSTALL_PREFIX})
-  set(exec_prefix ${CMAKE_INSTALL_PREFIX}/bin)
-  set(libdir ${CMAKE_INSTALL_PREFIX}/lib)
+  if(WITH_PKGCONFIG)
+    
+    set(PKGCFG_PREFIX "${CMAKE_INSTALL_PREFIX}")
+    set(PKGCFG_INC_DIR "${CMAKE_INSTALL_PREFIX}/${LIBLAS_INCLUDE_SUBDIR}")
+    set(PKGCFG_LIB_DIR "${CMAKE_INSTALL_PREFIX}/${LIBLAS_LIB_SUBDIR}")
+    set(PKGCFG_REQUIRES  "")
+    set(PKGCFG_VERSION ${VERSION})
+    set(PKGCFG_LINK_FLAGS "-llas -llas_c")
+    set(PKGCFG_COMPILE_FLAGS "")
+    if(LIBXML2_FOUND)
+      set(PKGCFG_REQUIRES "${PKGCFG_REQUIRES} libxml-2.0")
+    endif()
+    if(GEOTIFF_FOUND)
+      set(PKGCFG_REQUIRES "${PKGCFG_REQUIRES} geotiff")
+    endif()
+    #  if(WITH_GDAL)
+    #    set(PKGCFG_INC_DIR "${PKGCFG_INC_DIR} ${GDAL_INCLUDE_DIR}")
+    #  endif()
+    configure_file(${CMAKE_CURRENT_SOURCE_DIR}/liblas.pc.in
+      ${CMAKE_CURRENT_BINARY_DIR}/liblas.pc @ONLY)
+    install(FILES ${CMAKE_CURRENT_BINARY_DIR}/liblas.pc
+      DESTINATION ${LIBLAS_LIB_DIR}/pkgconfig
+      PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ)
+    
+  else()
 
-  configure_file(${CMAKE_CURRENT_SOURCE_DIR}/liblas-config.in
-    ${CMAKE_CURRENT_BINARY_DIR}/liblas-config @ONLY)
+    # Autoconf compatibility variables to use the same script source.
+    set(prefix ${CMAKE_INSTALL_PREFIX})
+    set(exec_prefix ${CMAKE_INSTALL_PREFIX}/bin)
+    set(libdir ${CMAKE_INSTALL_PREFIX}/lib)
+    
+    configure_file(${CMAKE_CURRENT_SOURCE_DIR}/liblas-config.in
+      ${CMAKE_CURRENT_BINARY_DIR}/liblas-config @ONLY)
+    
+    install(FILES ${CMAKE_CURRENT_BINARY_DIR}/liblas-config
+      DESTINATION bin/
+      PERMISSIONS
+      OWNER_READ OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
 
-  install(FILES ${CMAKE_CURRENT_BINARY_DIR}/liblas-config
-    DESTINATION bin/
-    PERMISSIONS
-    OWNER_READ OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
+  endif()
 
 endif()


More information about the Liblas-commits mailing list