Cmake does not find "gio-2.0'"

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.

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?

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?

I typed the above commands in the bash.

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=...

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.