添加链接
link之家
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接
Collectives™ on Stack Overflow

Find centralized, trusted content and collaborate around the technologies you use most.

Learn more about Collectives

Teams

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Learn more about Teams

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?

Did you set the 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, 2020 at 12:37

Thanks for contributing an answer to Stack Overflow!

  • Please be sure to answer the question. Provide details and share your research!

But avoid

  • Asking for help, clarification, or responding to other answers.
  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.