Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rely on ciso646 and __cplusplus macro when detecting cxx, add cxx11 flag #195

Closed
wants to merge 2 commits into from

Conversation

sovrasov
Copy link
Contributor

It seems that _LIBCPP_VERSION is not defined in the string header at least for GCC 5.4 and above.

printf "#include <string>\nint main () {}" | g++ -E -x c++ -dM - | grep CPP

@sovrasov sovrasov changed the title Rely on ciso646 and __cplusplus macro when detecting cxx Rely on ciso646 and __cplusplus macro when detecting cxx, add cxx11 flag Jul 16, 2018
@sovrasov
Copy link
Contributor Author

@jschueller please take a look. I need CXX11 macro in #194
It doesn't affect current algorithms, but can be useful in future.

@sovrasov sovrasov force-pushed the cmake_cxx_detection branch from 25b30d4 to b5a5afc Compare July 16, 2018 09:33
@@ -150,6 +150,9 @@
/* Define if compiled including C++-based routines */
#cmakedefine NLOPT_CXX

/* Define if compiled including C++11-based routines */
#cmakedefine NLOPT_CXX11
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this actually used anywhere? Why do we need -std=c++11 at all?

Copy link
Contributor Author

@sovrasov sovrasov Jul 16, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm going to use it to enable/disable AGS (like STOGO), since it's code heavily depends on c++11. May be it can be useful for future contributors who also use new C++. Now NLOPT_CXX is used only for STOGO and I thought to join these flags, but we can't assume that everyone who has c++ has c++11 compiler, unfortunately.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The STOGO code is ancient — mostly written in 1998, and incorporated in NLopt in 2007. How could it possibly depend heavily on C++11?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I meant future code and the code from #194.

@sovrasov
Copy link
Contributor Author

Moved to #194

@sovrasov sovrasov closed this Jul 17, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants