C++ 能否为一组目标设置makefile.am LDADD?
我将单元测试放在同一个源代码目录中。但是,如何在Makefile.am中为所有这些单元测试设置LDADD以使用特定库(例如google测试)?除非使用C++ 能否为一组目标设置makefile.am LDADD?,c++,unit-testing,automake,googletest,C++,Unit Testing,Automake,Googletest,我将单元测试放在同一个源代码目录中。但是,如何在Makefile.am中为所有这些单元测试设置LDADD以使用特定库(例如google测试)?除非使用target\u LDADD覆盖此变量,否则LDADD的内容将用于所有目标。因此,如果您有许多单元测试,并且只有几个实际的程序,那么您可以对单元测试使用LDADD,并针对具有不同链接要求的每个程序重写它 LDADD = libtest.a # Used by default for all targets # Unit tests, usin
target\u LDADD
覆盖此变量,否则LDADD的内容将用于所有目标。因此,如果您有许多单元测试,并且只有几个实际的程序,那么您可以对单元测试使用LDADD
,并针对具有不同链接要求的每个程序重写它
LDADD = libtest.a # Used by default for all targets
# Unit tests, using above LDADD
check_PROGRAMS = one two three
one_SOURCES = one.c
two_SOURCES = two.c
three_SOURCES = three.c
# Main program
bin_PROGRAMS = main
main_SOURCES = main.c
main_LDADD = # Override the LDADD setting.
类似的例子可以在中找到