<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=Windows-1252">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);" class="elementToProof">
Mark,</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);" class="elementToProof">
<br>
</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);" class="elementToProof">
The Makefile template that you sent me looks like it was based on a Makefile template for C programs, NOT C++ programs.</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);" class="elementToProof">
<br>
</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);" class="elementToProof">
For C++, you need to set CXX to the compiler and use CXXFLAGS for the C++ compiler flags.   Use<b> +=</b>.  Do not use
<b>:=</b> since MacPorts will likely want to add its own flags.</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);" class="elementToProof">
<br>
</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);" class="elementToProof">
LDFLAGS should be also be used to set any linker flags.  Again use<b> +=</b></div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);" class="elementToProof">
e,g,  LDFLAGS += </div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);" class="elementToProof">
<br>
</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);" class="elementToProof">
Here is the format.</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);" class="elementToProof">
<br>
</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);" class="elementToProof">
<span style="color: rgb(32, 31, 30); font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; background-color: rgb(255, 255, 255); display: inline !important;">$(MAIN): $(OBJS)</span><br>
</div>
<blockquote style="margin-top:0;margin-bottom:0">
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);" class="elementToProof">
<span style="color: rgb(36, 41, 47); font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; background-color: rgb(255, 255, 255); display: inline !important;"> $(CXX) $(CXXFLAGS) $(LDFLAGS) $(INCLUDES) -o $(MAIN) $(OBJS)
</span><span style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt;">$(LFLAGS) $(FWORKDIRS) $(LIBS) $(FWORKS)</span></div>
</blockquote>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);" class="elementToProof">
<br>
</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);" class="elementToProof">
where LFLAGS += library directories.</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);" class="elementToProof">
LIBS += library flags e.g.  -lm for math library</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);" class="elementToProof">
FWORKDIRS += Framework directories etc</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);" class="elementToProof">
<br>
</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);" class="elementToProof">
Rob</div>
<div id="appendonsend"></div>
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>From:</b> macports-dev <macports-dev-bounces@lists.macports.org> on behalf of Mark Brethen <mark.brethen@gmail.com><br>
<b>Sent:</b> August 8, 2022 12:22 PM<br>
<b>To:</b> Joshua Root <jmr@macports.org><br>
<b>Cc:</b> MacPorts Developers <macports-dev@lists.macports.org><br>
<b>Subject:</b> Re: include files for cgxCADTools</font>
<div> </div>
</div>
<div>
<div class="x_BodyFragment"><font size="2"><span style="font-size:11pt">
<div class="x_PlainText">The makefile only sets cc, not c++. If I remove -lstc++ from LIBS, then I need to add it to the portfile using LDFLAGS. The Makefile uses LFLAGS, which I don’t want to override. Should I add LDFLAGS to MAIN, like so:<br>
<br>
$(MAIN): $(OBJS) <br>
        $(CC) $(CFLAGS) $(INCLUDES) -o $(MAIN) $(OBJS) $(LFLAGS) $(LIBS) $(LDFLAGS)<br>
<br>
</div>
</span></font></div>
<div class="x_BodyFragment"><font size="2"><span style="font-size:11pt">
<div class="x_PlainText"><br>
<br>
<br>
<br>
<br>
<br>
Mark Brethen<br>
mark.brethen@gmail.com<br>
<br>
<br>
<br>
> On Aug 8, 2022, at 11:10 AM, Joshua Root <jmr@macports.org> wrote:<br>
> <br>
> That's a completely different thing. The language standard is selected by -std, the stdlib implementation is selected by -stdlib, and linking to a stdlib directly (as -lstdc++ does) is usually a bug since the C++ compiler will implicitly add the appropriate
 stdlib when linking.<br>
> <br>
> - Josh<br>
> <br>
> On 2022-8-9 01:16 , Mark Brethen wrote:<br>
>> There is also -lstdc++, I thought those should be set in the Portfile. Doesn’t macports-clang have its own standard?<br>
>> Mark Brethen<br>
>> mark.brethen@gmail.com <<a href="mailto:mark.brethen@gmail.com">mailto:mark.brethen@gmail.com</a>><br>
>>> On Aug 7, 2022, at 7:22 PM, Ryan Schmidt <ryandesign@macports.org <<a href="mailto:ryandesign@macports.org">mailto:ryandesign@macports.org</a>>> wrote:<br>
>>> <br>
>>> In fact, the Makefile already had -std=c++11, but your patchfile removed it. So don't remove it.<br>
> <br>
<br>
</div>
</span></font></div>
</div>
</body>
</html>