libzeug
libzeug copied to clipboard
Default OPTION_BUILD_WITH_STD_REGEX to false with gcc < 4.9
According to https://gcc.gnu.org/gcc-4.8/cxx0x_status.html and StackOverflow, gcc 4.8 which is the latest version shipped with Ubuntu Trusty 14.04 LTS does not support the
I suggest defaulting the above CMake option to false when a gcc below 4.9 is used. 4.9 officially supports regex. https://gcc.gnu.org/onlinedocs/libstdc++/manual/status.html#status.iso.2011 http://isocpp.org/blog/2014/04/gcc-4.9.0 That means boost regex will be required to build reflectionzeug with gcc 4.8 but that is better than an out-of-the-box broken build.
Other solutions or suggestions welcome. At the bare minimum this should be documented somewhere so the issue can be easily resolved by hand in the CMake config (only used the GitHub search for the above option and found only ifdef and cmake code, so blame me when it is already documented).
How about writing a platform check instead of checking the compiler version? This might help: http://www.cmake.org/cmake/help/v3.0/command/try_run.html
Although this feature will be pretty useful, our cmake options are currently designed to be atomic and directly manipulatable. Further, we declare the properties before the first compiler checks, so we can't depend on them. Implementing your suggestions would require to rethink the current cmake-init structure.
And to take the idea a bit further: What will the expected behavior be? Just defaulting the option in accordance to the used compiler? Removing the option and choosing the implementation completely dependent on the compiler? Would this apply to the OpenMP option, too? Currently, we haven't even checked if these implementations are fully exchangeable (fortunately, all current use cases are working).
Your thoughts, @sbusch42?
I like the idea of a platform check and also think this would be the cleanest solution. Options can always be overwritten by the user, therefore they are cache-variables, but the option could default to the result of the platform check. That way the default compilation would be very unlikely to fail, but the user can still override the default settings if he knows what he is doing. Options and default values in cmake can be a bit tricky to get right, but it should be possible to implement this without having to change a lot in our cmake-init structure. So, would anyone like to implement a proof-of-concept for this?