wxWidgets 自动会议设置未将包含目录设置为 -Isystem,而是设置为 -I

wxWidgets autoconf setup doesn't set include dirs as -Isystem but as -I

本文关键字:设置 -Isystem 包含目 会议 wxWidgets      更新时间:2023-10-16

我继承了一个使用 autoconf 和 automake 来构建的构建系统。除了在高层次上之外,我完全不熟悉它是如何工作的。

构建系统本身工作正常。但是,系统标头会生成许多警告。就我而言,wxWidgets。造成这种情况的原因是wxWidgets的包含目录被传递为-I而不是-isystem。我已经在网上搜索过,但我找不到如何改变这一点。

以下代码位于configure.ac文件中:

AM_OPTIONS_WXCONFIG
AM_PATH_WXCONFIG(3.0.2, wxWin=1, , ,[--debug=yes])
if test "$wxWin" != 1; then
AC_MSG_ERROR([
wxWidgets must be installed on your system
but no wx-config script could be found.
Please check that wx-config is in path, the directory
where wxWidgets libraries are installed as returned by
'wx-config --libs' is in the linker path (LD_LIBRARY_PATH
or equivalent variable) and wxWidgets version is 2.9.4 or
above.
])
fi
if test "$wxWin" != 0; then
AC_DEFINE(HAVE_WXWIDGETS,1,[define if the wxWidgets 3.0.2. or higher is available])
fi

然后有一个Makefile.am执行以下操作:

bin_PROGRAMS = project
project_SOURCES     =   {sources here}

project_CPPFLAGS    =   $(AM_CPPFLAGS) $(PROJECT_CPPFLAGS) $(WX_CPPFLAGS)
project_CFLAGS      =   $(AM_CFLAGS)   $(PROJECT_CFLAGS)    $(WX_CFLAGS)
project_CXXFLAGS    =   $(AM_CXXFLAGS) $(PROJECT_CXXFLAGS) $(WX_CXXFLAGS)
project_LDFLAGS         =   $(AM_LDFLAGS)
project_LDADD       =   $(AM_LIBADD)   $(WX_LIBS)

似乎没有一个选项可以以某种方式将其指定为系统标头。

你们中有谁知道我该如何解决这个问题吗?

该问题与自动确认无关。罪魁祸首是wx-config工具。该工具用于获取包含目录。例如,调用wx-config --cxxflag将导致:

-I/usr/lib/wx/include/gtk2-unicode-3.1 -I/usr/include/wx-3.1 -D_FILE_OFFSET_BITS=64 -DWXUSINGDLL -D__WXGTK__ -pthread

它被传递给编译器。有几种方法可以解决这个问题。要么在输出中手动替换它,要么修补 wx-config。