# Finding LibArchive on GitHub Action

**URL:** https://discourse.cmake.org/t/finding-libarchive-on-github-action/4990
**Category:** Usage
**Tags:** os:macos
**Created:** [February 11, 2022, 5:37pm UTC](https://discourse.cmake.org/t/finding-libarchive-on-github-action/4990 "2022-02-11T17:37:46Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![mrmsdbdl](https://discourse.cmake.org/user_avatar/discourse.cmake.org/mrmsdbdl/32/2686_2.png) [@mrmsdbdl](https://discourse.cmake.org/u/mrmsdbdl)
#### Post date: [February 11, 2022, 5:37pm UTC](https://discourse.cmake.org/t/finding-libarchive-on-github-action/4990/1 "2022-02-11T17:37:46Z")

</div>

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.

```cmake
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.

```auto
      - 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! 😊

---

<div class="post-metadata">

### Author: ![ben.boeckel](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/b/ea5d25/32.png) [@ben.boeckel](https://discourse.cmake.org/u/ben.boeckel)
#### Post date: [February 14, 2022, 12:27am UTC](https://discourse.cmake.org/t/finding-libarchive-on-github-action/4990/2 "2022-02-14T00:27:30Z")

</div>

> [@mrmsdbdl](#):
>
> I have tried to pass a list of paths, but that doesn’t seem to work.

The paths need to be semicolon-separated. There is also the `CMAKE_PREFIX_PATH` environment variable that uses the system separator instead (on macOS, `:`).

I would suggest using `--trace-expand` to see what command is actually being executed for `pkg-config`

---

<div class="post-metadata">

### Author: ![mrmsdbdl](https://discourse.cmake.org/user_avatar/discourse.cmake.org/mrmsdbdl/32/2686_2.png) [@mrmsdbdl](https://discourse.cmake.org/u/mrmsdbdl)
#### Post date: [February 14, 2022, 3:07pm UTC](https://discourse.cmake.org/t/finding-libarchive-on-github-action/4990/3 "2022-02-14T15:07:05Z")

</div>

> The paths need to be semicolon-separated. There is also the `CMAKE_PREFIX_PATH` environment variable that uses the system separator instead (on macOS, `:` ).

That’s probably what confused me a bit. I’m going to try it.

I have tried `--trace`, but I was not sure what’s happening. I’m going to try this and report! 🙂
