Linker flags in wrong place

后端 未结 1 525
暖寄归人
暖寄归人 2020-12-16 22:24

I\'m trying to use Autotools to build my C program that needs to be linked against certain libraries. It only contains one C source file.

This is the Makefile.am ass

相关标签:
1条回答
  • 2020-12-16 23:15

    You can start by not abusing LDFLAGS for libraries. LDFLAGS is for linker flags. Use foo_LDADD (for executables) or foobar_LIBADD (when producing a library) to list link libraries.

    Also, running pkg-config inside Makefile.am is unnecessary and wasteful. Just use:

    game_CFLAGS = ${libglfw_CFLAGS}
    game_LDADD  = ${libglfw_LIBS}
    

    libglfw_CFLAGS,LIBS is populated by this in configure.ac:

    PKG_CHECK_MODULES([libglfw], [libglfw])

    0 讨论(0)
提交回复
热议问题