For some reason I cannot convince CMake to find LibArchive! On my local machine, I don’t have any problem but when I’m trying to setup the CI on Github, find_package(LibArchive)
just doesn’t work (even though I expect Xcode to have a version of it), I also tried installing it via brew
and no luck again, I now have this, which doesn’t work either. I have confirmed by pkg-config --libs libarchive
that the library indeed exists but CMake keeps missing it for some reason. I’m using macos-11 and xcode-13.2 on GitHub Action environment.
find_package(LibArchive)
if(NOT LibArchive_FOUND)
find_package(PkgConfig REQUIRED)
pkg_check_modules(
LibArchive
REQUIRED
IMPORTED_TARGET
libarchive)
endif()
I even set the PKG_CONFIG_PATH
as follow before running my CMake config, and I can see that the variable is set correctly, but I guess for some reason CMake cannot read and set it.
- name: Setting up the Environment Variables
run: |
export PKG_CONFIG_PATH="/usr/local/opt/zlib/lib/pkgconfig:/usr/local/opt/openssl@3/lib/pkgconfig:/usr/local/opt/qt/lib/pkgconfig:/usr/local/opt/libarchive/lib/pkgconfig:/usr/local/Cellar/libarchive/3.5.2/lib/pkgconfig"
echo "PKG_CONFIG_PATH: ${PKG_CONFIG_PATH}"
pkg-config --libs libarchive
I can pass the path to CMAKE_PREFIX_PATH
like -DCMAKE_PREFIX_PATH=/usr/local/opt/libarchive
but then I cannot pass more than one path there. I have tried to pass a list of paths, but that doesn’t seem to work.
I would also really like to understand why setting PKG_CONFIG_PATH
doesn’t work because I certainly have more work to do with PkgConfig and it would be great if I figure this out.
I appreciate any help!