Closed joaander closed 8 years ago
HOOMD's cmake scripts already add -std=c++11
: https://bitbucket.org/glotzer/hoomd-blue/src/41205072bddf8a2b1feca4399d258ce5db686fc5/CMake/hoomd/HOOMDCFlagsSetup.cmake?at=maint&fileviewer=file-view-default
Are you working in a clean build directory?
Original comment by Christoph Junghans (Bitbucket: junghans, GitHub: junghans).
Well, Gentoo's emerge (from which the error is taken) ignores force set CXXFLAGS
to inject it own flags, e.g. -O2 -pipe -march=native -fomit-frame-pointer
in my case. This is to avoid problematic flags like -march=${GCC_ARCH}
in the package build. I guess due to that fact that hoomd-blue cannot be build without -std=c++11
it should always be appended and not be part of CMAKE_CXX_FLAGS
, which are more for the user to set (even though good defaults, like hoomd-blue has, are nice.)
Always add -std=c++11 to CXX_FLAGS
refs #173
I thought it best to put in per compiler settings because other compilers may not use the same arguments to enable the standard. But whatever, if it is good enough for gentoo, then it must be good enough for everybody. This also forces users that compile plugins to modify hoomd's cmake if they wish to compile their plugin to a different C++ standard.
The reason that hoomd defaults to -march=native is because most users do not even consider setting this, and the majority of hoomd users build it themselves on a cluster. Thus, I want the majority of users to obtain the best performance, which requires an SSE or AVX enabled arch to enable the hand-optimized vector code paths in HOOMD.
pull request #220 implements the suggested fix.
Always add -std=c++11 to CXX_FLAGS
refs #173
Merged in always-add-cpp11 (pull request #220)
Always add -std=c++11 to CXX_FLAGS
fixes #173
Original report by Christoph Junghans (Bitbucket: junghans, GitHub: junghans).
Adding
-std=c++11
to CXXFLAGS fixed that, I guess cmake should do that automatically.