# Cmake does not find "gio-2.0'"

**URL:** https://discourse.cmake.org/t/cmake-does-not-find-gio-2-0/2551
**Category:** Usage
**Created:** [January 15, 2021, 1:53am UTC](https://discourse.cmake.org/t/cmake-does-not-find-gio-2-0/2551 "2021-01-15T01:53:38Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![colt](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/c/c67d28/32.png) [@colt](https://discourse.cmake.org/u/colt)
#### Post date: [January 15, 2021, 1:53am UTC](https://discourse.cmake.org/t/cmake-does-not-find-gio-2-0/2551/1 "2021-01-15T01:53:38Z")

</div>

Hello. This time I am using cmake in another program and it cannot find three other packages. One of them it is: gio-2.0

I executed `cmake .` and it returned:

> – valac 0.30.0 found  
> – Checking for modules ‘sqlite3\>=3.6.19;gio-2.0\>=2.48.0;libsoup-gnome-2.4\>=2.48.0’  
> – No package ‘sqlite3’ found  
> – No package ‘gio-2.0’ found  
> – No package ‘libsoup-gnome-2.4’ found  
> CMake Error at /media/34GB/Arquivos-de-Programas-Linux/Cmake-3.19.2-Linux-x86\_64/share/cmake-3.19/Modules/FindPkgConfig.cmake:553 (message):  
> A required package was not found  
> Call Stack (most recent call first):  
> /media/34GB/Arquivos-de-Programas-Linux/Cmake-3.19.2-Linux-x86\_64/share/cmake-3.19/Modules/FindPkgConfig.cmake:741 (\_pkg\_check\_modules\_internal)  
> CMakeLists.txt:47 (pkg\_check\_modules

I believe this “gio-2.0” it is part of glib, since in its folder there is a `libgio-2.0.so.0.4800.0`. So I tried `CMAKE_PREFIX_PATH=/media/34GB/Arquivos-de-Programas-Linux/Glib-2.48.0/lib/ cmake .`

However, the output was the same! Usaing --debug-find didn’t reveal anything interesting either.

---

<div class="post-metadata">

### Author: ![colt](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/c/c67d28/32.png) [@colt](https://discourse.cmake.org/u/colt)
#### Post date: [January 17, 2021, 1:06am UTC](https://discourse.cmake.org/t/cmake-does-not-find-gio-2-0/2551/2 "2021-01-17T01:06:15Z")

</div>

Ok. I read CMakeLists and figure out why it did not work. To find Vala, it used `find_package (Vala REQUIRED)`. But for these three packages it uses: `find_package (PkgConfig)` followed by

> pkg\_check\_modules(DEPS REQUIRED  
> sqlite3\>=3.6.19  
> gio-2.0\>=2.48.0  
> libsoup-gnome-2.4\>=2.48.0  
> )  
> set(PKGS sqlite3 gio-2.0 libsoup-2.4)

I tried

> set(ENV{PKG\_CONFIG\_PATH} “${CMAKE\_SOURCE\_DIR}/media/34GB/Arquivos-de-Programas-Linux/Glib-2.48.0/lib/pkgconfig/”)

but received:

```
bash: syntax error near unexpected token `ENV{PKG_CONFIG_PATH}'`

```

I also tried this (although it was commented that this method does not work):

```
set (CMAKE_PREFIX_PATH "${CMAKE_SOURCE_DIR}/media/34GB/Arquivos-de-Programas-Linux/Glib-2.48.0/")

```

but I received the same kind of error message:

```
bash: syntax error near unexpected token `CMAKE_PREFIX_PATH'    

```

What I am doing wrong?

---

<div class="post-metadata">

### Author: ![Angew](https://discourse.cmake.org/user_avatar/discourse.cmake.org/angew/32/229_2.png) [@Angew](https://discourse.cmake.org/u/Angew)
#### Post date: [January 18, 2021, 8:54am UTC](https://discourse.cmake.org/t/cmake-does-not-find-gio-2-0/2551/3 "2021-01-18T08:54:24Z")

</div>

You’re getting bash syntax errors, which means you’re apparently executing CMake code (the two `set()` commands) using bash instead of CMake. You wrote that you “tried” them — how exactly?

---

<div class="post-metadata">

### Author: ![colt](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/c/c67d28/32.png) [@colt](https://discourse.cmake.org/u/colt)
#### Post date: [January 24, 2021, 1:12am UTC](https://discourse.cmake.org/t/cmake-does-not-find-gio-2-0/2551/4 "2021-01-24T01:12:13Z")

</div>

I typed the above commands in the bash.

---

<div class="post-metadata">

### Author: ![Angew](https://discourse.cmake.org/user_avatar/discourse.cmake.org/angew/32/229_2.png) [@Angew](https://discourse.cmake.org/u/Angew)
#### Post date: [January 25, 2021, 10:00am UTC](https://discourse.cmake.org/t/cmake-does-not-find-gio-2-0/2551/5 "2021-01-25T10:00:03Z")

</div>

Well, as I said, they are CMake commands, so typing them into bash is not the way to go.

The first `set` command you tried sets an environment variable, so this can be converted to just `PKG_CONFIG_PATH=...` in bash syntax (potentially prefixed with `export`).

The second sets a CMake variable, so either move it into CMake code (into an appropriate `CMakeLists.txt` file), or pass it from the command line when invoking CMake:

```
cmake -DCMAKE_PREFIX_PATH=...
```

---

<div class="post-metadata">

### Author: ![colt](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/c/c67d28/32.png) [@colt](https://discourse.cmake.org/u/colt)
#### Post date: [January 30, 2021, 11:58pm UTC](https://discourse.cmake.org/t/cmake-does-not-find-gio-2-0/2551/6 "2021-01-30T23:58:54Z")

</div>

Do you mean like this:

> cmake -DCMAKE\_PREFIX\_PATH=/media/34GB/Arquivos-de-Programas-Linux/Glib-2.48.0/lib/pkgconfig/

It does not work.

About the first, I have this on CMakeLists:

> find\_package(PkgConfig)  
> pkg\_check\_modules(DEPS REQUIRED  
> sqlite3\>=3.6.19  
> gio-2.0\>=2.48.0  
> libsoup-gnome-2.4\>=2.48.0  
> )  
> set(PKGS sqlite3 gio-2.0 libsoup-2.4)

What is necessary to change on it?

EDITED:

Ok, I solved it with:

> PKG\_CONFIG\_PATH=/media/34GB/Arquivos-de-Programas-Linux/Glib-2.48.0/lib/pkgconfig/ cmake .

Now I proceed to the next libraries.
