我有一个用于共享库的 Meson 项目。它使用一个 CMake 子项目,它提供一个静态库:
cmake = import('cmake')
sub_prj = cmake_subproject('some_subproject-1.0.0')
sub_dep = sub_prj.dependency('static_sublib')
...
my_lib = library('my_lib', ..., dependencies : sub_dep)
介子给了我以下错误:
ERROR: Can't link non-PIC static library 'cm_gsl' into shared library 'toolbox'. Use the 'pic' option to static_library to build with PIC.
如何告诉 CMake 模块静态库必须具有与位置无关的代码?