Skip to content
This repository has been archived by the owner on Jan 4, 2023. It is now read-only.

cannot use find_package(tinyb) in x64 #177

Open
tswaehn opened this issue Dec 29, 2020 · 3 comments
Open

cannot use find_package(tinyb) in x64 #177

tswaehn opened this issue Dec 29, 2020 · 3 comments

Comments

@tswaehn
Copy link

tswaehn commented Dec 29, 2020

I am using CMAKE 3.13+

the install will be incorrect. see log below

the root cause might be incorrect place of /usr/lib/pkgconfig/tinyb.pc this should be lib64

Install the project...
-- Install configuration: ""
-- Installing: ./usr/include/tinyb.hpp
-- Installing: ./usr/include/tinyb
-- Installing: ./usr/include/tinyb/BluetoothDevice.hpp
-- Installing: ./usr/include/tinyb/BluetoothUUID.hpp
-- Installing: ./usr/include/tinyb/BluetoothManager.hpp
-- Installing: ./usr/include/tinyb/BluetoothGattDescriptor.hpp
-- Installing: ./usr/include/tinyb/BluetoothGattCharacteristic.hpp
-- Installing: ./usr/include/tinyb/BluetoothGattService.hpp
-- Installing: ./usr/include/tinyb/BluetoothEvent.hpp
-- Installing: ./usr/include/tinyb/BluetoothAdapter.hpp
-- Installing: ./usr/include/tinyb/BluetoothException.hpp
-- Installing: ./usr/include/tinyb/BluetoothObject.hpp
-- Installing: ./usr/lib/pkgconfig/tinyb.pc
-- Installing: ./usr/lib64/libtinyb.so.0.5.1
-- Installing: ./usr/lib64/libtinyb.so.0
-- Installing: ./usr/lib64/libtinyb.so
@tswaehn
Copy link
Author

tswaehn commented Dec 29, 2020

in CMakeLists.txt the LIB_SUFFIX can be replaced with CMAKE_INSTALL_LIBDIR from GNUInstallDirs

@tswaehn
Copy link
Author

tswaehn commented Dec 29, 2020

this should do the trick:


git diff
diff --git a/CMakeLists.txt b/CMakeLists.txt
index bef0609..0db0e5a 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required (VERSION 3.0.0 FATAL_ERROR)
+cmake_minimum_required (VERSION 3.13.0 FATAL_ERROR)
 project (tinyb)
 
 FIND_PACKAGE (Threads REQUIRED)
@@ -10,7 +10,6 @@ PKG_CHECK_MODULES (GIO-UNIX REQUIRED gio-unix-2.0>=2.40)
 
 set (CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Wall -Wextra -fno-omit-frame-pointer -DDEBUG")
 set (CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -Wall")
-set (LIB_INSTALL_DIR "lib${LIB_SUFFIX}" CACHE PATH "Installation path for libraries")
 
 # Set CMAKE_LIB_INSTALL_DIR if not defined
 include(GNUInstallDirs)
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 238549e..f7818b4 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -53,7 +53,7 @@ macro (tinyb_CREATE_INSTALL_PKGCONFIG generated_file install_location)
   configure_file (${generated_file}.cmake ${CMAKE_CURRENT_BINARY_DIR}/${generated_file} @ONLY)
   install (FILES ${CMAKE_CURRENT_BINARY_DIR}/${generated_file} DESTINATION ${install_location})
 endmacro (tinyb_CREATE_INSTALL_PKGCONFIG)
-tinyb_create_install_pkgconfig (tinyb.pc lib${LIB_SUFFIX}/pkgconfig)
+tinyb_create_install_pkgconfig (tinyb.pc ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
 
 install(TARGETS tinyb LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
 
diff --git a/src/tinyb.pc.cmake b/src/tinyb.pc.cmake
index 1c9fbaf..3a6f853 100644
--- a/src/tinyb.pc.cmake
+++ b/src/tinyb.pc.cmake
@@ -1,6 +1,6 @@
 prefix=@CMAKE_INSTALL_PREFIX@
 exec_prefix=${prefix}
-libdir=${exec_prefix}/lib@LIB_SUFFIX@
+libdir=${exec_prefix}/@CMAKE_INSTALL_LIBDIR@
 includedir=${prefix}/include
 
 Name: tinyb

@tswaehn tswaehn mentioned this issue Dec 29, 2020
@tswaehn
Copy link
Author

tswaehn commented Dec 29, 2020

@intel-iot-devkit -- I did create a fix and pull request.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant