Integrating zbar library in qt6.4

106 Views Asked by At

I was able to install the qt into my machine and now I have started to build my project which is the scanning of the barcode reader. I have decided to use 'zbar' library for this purpose and installed the same in my macOs.

This is how I verified the installation of 'zbar'.

apple@Apples-MacBook-Air barcode % pkg-config --cflags --libs zbar 
-I/usr/local/Cellar/zbar/0.23.90_4/include -L/usr/local/Cellar/zbar/0.23.90_4/lib -lzbar

Now, I would like to integrate this in my Qt6.4 project and I started with:

target_link_libraries(camera PUBLIC /usr/local/Cellar/zbar/0.23.90_4/lib/libzbar)

And this did not work.

How do I integrate 'zbar' and Qt 6.4 otherwise? Any leads would be appreciated. Thank you.

1

There are 1 best solutions below

0
Hemant Bhargava On

I was able to find an answer to this question by doing like this:

find_package(PkgConfig REQUIRED)
pkg_check_modules(ZBar REQUIRED IMPORTED_TARGET zbar)
target_link_libraries(camera PUBLIC PkgConfig::ZBar)

Since I anyway had pkgconfig, I found that package and then zbar using that package and then linked it with the libraries.