1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

Makefile.include: Link with $(CXX) for C++ code

When mixing C and C++ code, $(CXX) has to be used for linking. Prior to this
commit, the build system automatically uses $(CXX) if the application contains
C++ source code. However, if C++ is used in an module only, $(CC) is still
used. This has not let to problems, as internal modules must be written in C.
For external modules this restriction does not apply.

This commit checks if the cpp feature is used. In that case, $(CXX) is used
for linking over $(CC). This way external modules may use C++ code.
This commit is contained in:
Marian Buschsieweke 2020-07-09 21:15:38 +02:00
parent f3bce19646
commit 267c8e1620
No known key found for this signature in database
GPG Key ID: 61F64C6599B1539F

View File

@ -536,7 +536,9 @@ else
endif
# variables used to compile and link c++
CPPMIX ?= $(if $(wildcard *.cpp),1,)
ifneq (,$(filter cpp,$(FEATURES_USED)))
CPPMIX ?= 1
endif
# We assume $(LINK) to be gcc-like. Use `LINKFLAGPREFIX :=` for ld-like linker options.
LINKFLAGPREFIX ?= -Wl,