From b0b9123a2e748419c4924bd31898a16f631cbc51 Mon Sep 17 00:00:00 2001 From: nirenjan Date: Sat, 8 Jun 2024 21:11:54 -0700 Subject: [PATCH] fix: Add CMOCKA_CFLAGS to test program CFLAGS In macos-14, programs that rely on cmocka need to specify CMOCKA_CFLAGS as part of their CFLAGS. This has not been an issue so far on older versions of macOS, or on any release of Ubuntu, but it should be done to ensure that the library headers can be found. --- cli/Makefile.am | 2 +- daemon/Makefile.am | 2 +- libx52/Makefile.am | 4 ++-- libx52io/Makefile.am | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/cli/Makefile.am b/cli/Makefile.am index ea5c7d1..25df2f1 100644 --- a/cli/Makefile.am +++ b/cli/Makefile.am @@ -17,7 +17,7 @@ TESTS += test-cli check_PROGRAMS += test-cli test_cli_SOURCES = cli/x52_cli.c cli/test_x52_cli.c -test_cli_CFLAGS = -DX52_CLI_TESTING -I $(top_srcdir)/libx52 +test_cli_CFLAGS = @CMOCKA_CFLAGS@ -DX52_CLI_TESTING -I $(top_srcdir)/libx52 test_cli_LDFLAGS = @CMOCKA_LIBS@ $(WARN_LDFLAGS) # Add a dependency on test_x52_cli_tests.c diff --git a/daemon/Makefile.am b/daemon/Makefile.am index d6cd95b..98e6244 100644 --- a/daemon/Makefile.am +++ b/daemon/Makefile.am @@ -126,7 +126,7 @@ x52d_mouse_test_CFLAGS = \ -I $(top_srcdir)/libx52 \ -I $(top_srcdir)/libx52io \ -I $(top_srcdir)/lib/pinelog \ - $(WARN_CFLAGS) + $(WARN_CFLAGS) @CMOCKA_CFLAGS@ x52d_mouse_test_LDFLAGS = @CMOCKA_LIBS@ $(WARN_LDFLAGS) x52d_mouse_test_LDADD = \ lib/pinelog/libpinelog.la \ diff --git a/libx52/Makefile.am b/libx52/Makefile.am index 6ba8a4e..a3cda40 100644 --- a/libx52/Makefile.am +++ b/libx52/Makefile.am @@ -43,7 +43,7 @@ check_PROGRAMS += libx52test libx52-string-test nodist_libx52test_SOURCES = libx52/test_libx52.c libx52test_SOURCES = $(libx52_la_SOURCES) -libx52test_CFLAGS = @LIBUSB_CFLAGS@ -DLOCALEDIR='"$(localedir)"' -I $(top_srcdir) -I $(top_srcdir)/libx52 +libx52test_CFLAGS = @CMOCKA_CFLAGS@ @LIBUSB_CFLAGS@ -DLOCALEDIR='"$(localedir)"' -I $(top_srcdir) -I $(top_srcdir)/libx52 libx52test_CFLAGS += -Dlibusb_control_transfer=__wrap_libusb_control_transfer libx52test_LDFLAGS = @CMOCKA_LIBS@ @LIBUSB_LIBS@ libx52test_LDADD = libx52.la @@ -60,7 +60,7 @@ libx52_string_test_SOURCES = \ libx52/test_strings.c \ libx52/x52_stringify.c \ libx52/x52_strerror.c -libx52_string_test_CFLAGS = -I $(top_srcdir) -I $(top_srcdir)/libx52 +libx52_string_test_CFLAGS = @CMOCKA_CFLAGS@ -I $(top_srcdir) -I $(top_srcdir)/libx52 libx52_string_test_LDFLAGS = @CMOCKA_LIBS@ libx52_string_test_LDADD = libx52.la endif diff --git a/libx52io/Makefile.am b/libx52io/Makefile.am index 1d2f0b6..77adcea 100644 --- a/libx52io/Makefile.am +++ b/libx52io/Makefile.am @@ -37,12 +37,12 @@ TESTS += test-axis test-parser check_PROGRAMS += test-axis test-parser test_axis_SOURCES = libx52io/test_axis.c $(libx52io_la_SOURCES) -test_axis_CFLAGS = $(libx52io_la_CFLAGS) +test_axis_CFLAGS = @CMOCKA_CFLAGS@ $(libx52io_la_CFLAGS) test_axis_LDFLAGS = @CMOCKA_LIBS@ @HIDAPI_LIBS@ $(WARN_LDFLAGS) test_axis_LDADD = @LTLIBINTL@ test_parser_SOURCES = libx52io/test_parser.c $(libx52io_la_SOURCES) -test_parser_CFLAGS = $(libx52io_la_CFLAGS) +test_parser_CFLAGS = @CMOCKA_CFLAGS@ $(libx52io_la_CFLAGS) test_parser_LDFLAGS = @CMOCKA_LIBS@ @HIDAPI_LIBS@ $(WARN_LDFLAGS) test_parser_LDADD = @LTLIBINTL@