orocos / orocos-bayesian-filtering

The orocos Bayesian Filtering Library

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Please use GNUInstallDirs to pick the right installation path

josch opened this issue · comments

commented

Hi,

on some distributions (Debian and derivatives) shared libraries and the pkg-config file go into an architecture qualified path. For example on amd64, the shared library would have to be installed to /usr/lib/x86_64-linux-gnu/. This allows to install libraries from multiple architectures at the same time. To achieve this in CMake and to do the right thing depending on the platform, the GNUInstallDirs module exists. The following patch is what we use in Debian:

--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -16,9 +16,9 @@ ENDIF( OROCOS_PLUGIN )
 
 # examples will be linked with orocos-bfl, so when building both static and shared, examples will link with shared
 IF (LIBRARY_TYPE STREQUAL "shared")
+  include(GNUInstallDirs)
   ADD_LIBRARY(orocos-bfl SHARED $ENV{GLOBAL_LIBRARY_SRCS})
-  SET_TARGET_PROPERTIES(orocos-bfl PROPERTIES OUTPUT_NAME orocos-bfl)
-  INSTALL_TARGETS( /lib orocos-bfl)       
+  INSTALL(TARGETS orocos-bfl LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT library)
 ELSE (LIBRARY_TYPE STREQUAL "shared")
 
 IF (LIBRARY_TYPE STREQUAL "static")
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -113,7 +113,8 @@ ADD_SUBDIRECTORY( examples )
 # .pc file
 # --------
 CONFIGURE_FILE( orocos-bfl.pc.in orocos-bfl.pc @ONLY)
-INSTALL_FILES( /lib/pkgconfig FILES orocos-bfl.pc)
+include(GNUInstallDirs)
+INSTALL_FILES( "/${CMAKE_INSTALL_LIBDIR}/pkgconfig" FILES orocos-bfl.pc)
 
 
 # Building Doxygen documents

Please consider using GNUInstallDirs. Thanks!

Thx for submitting the issue and the patch! I'm not sure against which version you provided the patch? If possible, could you provide a pull request, that makes my life easier :-)

Shoud be fixed by d010f03.

commented

I could provide a pull request but it's not needed anymore, is it? Because you already fixed the issue in commit d010f03.

Sorry, was typing too fast, I meant, could you provide a pull request "next time". Thx for the patch!

commented

Okay, will do! Thanks for maintaining orocos-bfl! :)