Automake AM_LDADD workaround

前端 未结 2 1875
庸人自扰
庸人自扰 2020-12-19 13:27

I want to set the same LDADD attribute (Unit test library) to a large number of targets (unit test C++ files). I first though that maybe automake has AM_LDADD variable to ad

2条回答
  •  长情又很酷
    2020-12-19 14:14

    It's a bad idea to modify LDADD in your Makefile.am, even if it seems convenient. It will make your build system very fragile.

    In particular, if the user attempts to override LDADD from the make command line, then your definition of LDADD in Makefile.am will disappear. It's not unreasonable to expect that a user might override LDADD, so you should definitely protect yourself against this situation.

    Your original definitions of test1_LDADD, ...,test20_LDADD are much more robust and, as far as I understand the automake manual, the recommended use.

    See the remarks here for more info: https://www.gnu.org/software/automake/manual/html_node/User-Variables.html https://www.gnu.org/software/automake/manual/html_node/Flag-Variables-Ordering.html

提交回复
热议问题