[CMake] Why does pkg_check_modules not use CMAKE_SYSTEM_PREFIX_PATH?

Shoaib Meenai smeenai at fb.com
Wed Aug 22 17:01:53 EDT 2018


Hi,

I'm using CMake for cross-compilation, and I have a toolchain file which sets CMAKE_SYSTEM_PREFIX_PATH accordingly. I'm running into issues with pkg_check_modules not finding some modules because it only searches inside CMAKE_PREFIX_PATH and not CMAKE_SYSTEM_PREFIX_PATH (where my *.pc files are located).

I'm wondering why this is the case. From my understanding, CMAKE_SYSTEM_PREFIX_PATH is intended to contain prefixes for the system, and CMAKE_PREFIX_PATH is intended to contain prefixes for the project. In this case, since I'm cross-compiling (which defines my "system"), it seems appropriate to set CMAKE_SYSTEM_PREFIX_PATH inside my toolchain file, but then that doesn't end up influencing the pkg-config search as I would like.

Should I be setting CMAKE_PREFIX_PATH inside my toolchain file, either instead of or in addition to CMAKE_SYSTEM_PREFIX_PATH, or should pkg_check_modules also honor CMAKE_SYSTEM_PREFIX_PATH? I suppose another option would be to set the PKG_CONFIG_PATH environment variable inside my toolchain file directly, but that seems kinda ugly.

Thanks,
Shoaib
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://cmake.org/pipermail/cmake/attachments/20180822/924833b2/attachment.html>


More information about the CMake mailing list