Remove c++11 as compilers have beyond it by default
Moving the -std=c++11 flag to build files for this project only. emp-base.cmake get imported by static libraries and flags for older version is difficult to override at times.
Projects consuming this library can limit to specific C++ standard version using:
set(CMAKE_CXX_STANDARD 11) # or 17 or 20, etc.
I'm a bit confused. If you add --std=c++14 in your code, would it use 14 or 11?
I'm a bit confused. If you add --std=c++14 in your code, would it use 14 or 11?
With current setup it will still end up as 11. After this fix, it would use 14. Ideally 'set(CMAKE_CXX_STANDARD ##)' is better way to setup cmake.
Would it work if I put set(CMAKE_CXX_STANDARD 11) in emp-base.cmake? I'm just trying to see if there is a way to enforce a minimum level of C++ standard. It appears that CMAKE_CXX_STANDARD sets the default level of standard and you can overwrite it later on?
I have tested on multiple platforms but I cannot reproduce it. In particular, with the current code, when I add -std=c++17, the code will be compiled with 17.
Where are you adding -std=c++17? Adding it here might work, but if this library is hard-coding c++11 then code which is building with this a static library runs into c++11 as this library's make file includes are hard-coding it.
Would it work if I put set(CMAKE_CXX_STANDARD 11) in emp-base.cmake? That would also make this library hard-code this requirement. Can you make it configurable instead then?
Please look at the latest version if that works. You can now specify the default standard by using, e.g., cmake -DCMAKE_CXX_STANDARD=14 ..