我想通过qmake .pro 文件设置Libs:
行,我尝试这样做:
LIBS += -ldl
也将我的目标可执行文件也链接到dl
库,因为我正在尝试使用dl
链接库。但是,这不起作用,qmake
将此字符串放在Libs.private
部分中,而该字符串在编译过程中没有传递给gcc
命令行,因此我无法生成可执行文件:>
Libs.private: -ldl
同时我希望它位于Libs:
行中,
Libs: -lmylibrary -ldl
在网络的任何地方,我也找不到对QMAKE_PKGCONFIG_*
变量的引用,有吗?
答案 0 :(得分:0)
用于生成.pc文件:
CONFIG += create_pc create_prl no_install_prl
通过摸索QMAKE_PKGCONFIG_
,我在~/5.12.0/clang_64/mkspecs/features/qt_module.prf
中发现了以下内容
QMAKE_PKGCONFIG_DESTDIR
QMAKE_PKGCONFIG_LIBDIR
QMAKE_PKGCONFIG_INCDIR
QMAKE_PKGCONFIG_CFLAGS
QMAKE_PKGCONFIG_NAME
QMAKE_PKGCONFIG_FILE
QMAKE_PKGCONFIG_REQUIRES
QMAKE_PKGCONFIG_DESCRIPTION
QMAKE_PKGCONFIG_INSTALL_REPLACE
在pkg-config的手册页中:
Libs.private:
This line should list any private libraries in use.
Private libraries are libraries which are not exposed through your library,
but are needed in the case of static linking.
This differs from Requires.private in that it references
libraries that do not have package files installed.
因此,我想只要您不通过lib导出它们,它们都将以Libs.private结尾。