Skip to content

Commit 82c495b

Browse files
committed
chore: move test-specific defines from CXXFLAGS to CPPFLAGS
This ensures that preprocessor flags are managed separately from compiler flags, avoiding confusion with user-provided CXXOPTS. Co-authored-by: Oliver Stöneberg <firewave@users.noreply.github.com>
1 parent d3b0ba1 commit 82c495b

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

Makefile

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,17 @@
11
all: testrunner simplecpp
22

3+
CPPFLAGS ?=
34
CXXFLAGS = -Wall -Wextra -pedantic -Wcast-qual -Wfloat-equal -Wmissing-declarations -Wmissing-format-attribute -Wredundant-decls -Wundef -Wno-multichar -Wold-style-cast -std=c++11 -g $(CXXOPTS)
45
LDFLAGS = -g $(LDOPTS)
56

6-
# Define test source dir macro for compilation
7-
TEST_DEFINES = -DSIMPLECPP_TEST_SOURCE_DIR=\"$(CURDIR)\"
7+
# Define test source dir macro for compilation (preprocessor flags)
8+
TEST_CPPFLAGS = -DSIMPLECPP_TEST_SOURCE_DIR=\"$(CURDIR)\"
89

910
# Only test.o gets the define
10-
test.o: CXXFLAGS += $(TEST_DEFINES)
11+
test.o: CPPFLAGS += $(TEST_CPPFLAGS)
1112

1213
%.o: %.cpp simplecpp.h
13-
$(CXX) $(CXXFLAGS) -c $<
14+
$(CXX) $(CPPFLAGS) $(CXXFLAGS) -c $<
1415

1516
testrunner: test.o simplecpp.o
1617
$(CXX) $(LDFLAGS) simplecpp.o test.o -o testrunner

0 commit comments

Comments
 (0)