-
-
Notifications
You must be signed in to change notification settings - Fork 633
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added shared_ptr handling for C++03 mode.
- Loading branch information
Showing
1 changed file
with
7 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
f3dfc03
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems to have done the trick. Now I'm only worried about MacOS compilation, I remember having some <tr1/memory> issues there. Can anyone with a mac try this out?
f3dfc03
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Building with the Makefile fails:
f3dfc03
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Building with XCode fails:
f3dfc03
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Keep in mind OSX uses Clang, not GCC.
f3dfc03
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If OSX uses clang, then it should be using the
c++11
flag, so it should take the C++11 path in the middle. Weird. But I expected some problems with this, we've hit this before. Any recommendations on how to#ifdef
this?f3dfc03
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My compiler's
__cplusplus
is at 199711 withoutstd=c++11
. With, it's at 201103, but it'll still end up at#else
.#elif (__cplusplus > 201103L)
should be#elif (__cplusplus >= 201103L)
, and cmake needs to set the c++11 flagwhen it canfor XCode.f3dfc03
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We want to use the C++11 flag as little as we can because we still support C++03 compilers (VC2008). I guess I've borked the
#elif
, will try>=
f3dfc03
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I found the issue. You need to add
add_flags_cxx("-stdlib=libc++")
after line 191 of SetFlags.cmake, as well as the>=
to the elif.f3dfc03
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not too comfortable forcing flags on the compiler that I don't know what they exactly do. If it works with only the comparison change, then I'd prefer to leave everything else as-is.
f3dfc03
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With the comparison change, the Makefile generator will compile correctly, but not XCode. That flag in SetFlags.cmake is only applied for Clang, and switches the standard library to use C++11. As far as I can tell, that switch is required in order for the
__cplusplus
macro to be at least 201103L.f3dfc03
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would have to test building with Clang on Linux as well, probably in a VM.
f3dfc03
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#936