0

I have an external SDK which has all the libs and includes on.

Now to make it work, I need to set CMAKE_PREFIX_PATH with my path, so I'm trying to set the variable inside of CMake file like this:

set(CMAKE_PREFIX_PATH "/my/path/to/SDK")

But for some reason is not working as I would expect because it's not going to find some packages with the function pkg_check_modules.

On the other hand, I've I'm going into terminal and I will call CMake like this, everything is fine and this's going to work as intended.

cmake -DCMAKE_PREFIX_PATH=/my/path/to/SDK ..

Here it's a part of my CMake file:

cmake_minimum_required(VERSION 2.8.7)

set(PKG_CONFIG_USE_CMAKE_PREFIX_PATH ON)
set(CMAKE_PREFIX_PATH "/my/path/to/SDK")

project(wayland_egl C CXX)

include(FindPkgConfig)

pkg_check_modules(WLCLIENT REQUIRED wayland-webos-client)
include_directories(${WLCLIENT_INCLUDE_DIRS})

Could one of you guys explain to me why is this happening and how can I fix my CMake file to work it properly?

Mircea
  • 1,671
  • 7
  • 25
  • 41
  • Did you set the [`PKG_CONFIG_USE_CMAKE_PREFIX_PATH`](https://cmake.org/cmake/help/latest/module/FindPkgConfig.html#variable:PKG_CONFIG_USE_CMAKE_PREFIX_PATH) variable to 1 to indicate to `pkg_check_modules` to add the paths in `CMAKE_PREFIX_PATH` to the search? – Kevin Feb 12 '20 at 12:37
  • yes I did, but it's exctly the same – Mircea Feb 12 '20 at 12:40

0 Answers0