如何解决CMake 将绝对 CMAKE_SYSROOT 路径添加到 pkg-config pc 文件
我正在尝试交叉编译 webkit。
在我的工具链文件中设置:
set(CMAKE_SYSROOT "/opt/cross-pi-gcc/arm-linux-gnueabihf/sysroot")
在配置期间我指定安装目录
-DCMAKE_INSTALL_PREFIX:PATH=/opt/cross-pi-gcc/arm-linux-gnueabihf/sysroot/usr
包的其中一个 CMakeLists 生成一个 pkg-config *.PC 文件,其中包含:
prefix=/opt/cross-pi-gcc/arm-linux-gnueabihf/sysroot/usr
exec_prefix=${prefix}
includedir=${prefix}/include
libdir=${exec_prefix}/lib
Name: wpe-1.0
Description: The wpe library
Version: 1.8.0
Requires: xkbcommon
Cflags: -I${includedir}/wpe-1.0
Libs: -L${libdir} -lwpe-1.0
这是错误的,pkg-config cflags 应该指向目标上的 /usr 而不是 sysroot 路径。
pkgconfig 文件的来源,使用 cmake 的 configure_file 编辑:
prefix=@CMAKE_INSTALL_PREFIX@
exec_prefix=${prefix}
includedir=${prefix}/include
libdir=${exec_prefix}/lib
Name: wpe-@WPE_API_VERSION@
Description: The wpe library
Version: @PROJECT_VERSION@
Requires: xkbcommon
Cflags: -I${includedir}/wpe-@WPE_API_VERSION@
Libs: -L${libdir} -lwpe-@WPE_API_VERSION@
我是否正确使用了 CMAKE_INSTALL_PREFIX?或者它可以以某种方式相对 CMAKE_SYSROOT?
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。