UG4 / ugcore

The core functionality of UG4. Includes sources, build-scripts, and utility scripts.
https://github.com/UG4/ugcore
Other
36 stars 23 forks source link

Enable CXX11 if possible. #37

Closed stephanmg closed 3 years ago

stephanmg commented 3 years ago

Proposed change to detect C++11 compatible compiler and add CMake flags.

sreiter commented 3 years ago

Hey Stephan, I think your current approach works for gcc and clang only (maybe some more). CMake offers a pretty clean way to enable different standards for individual targets:

target_compile_features (someTarget PUBLIC cxx_std_11)

If you would enable this on ugcore, all targets which link against ugcore would autmoatically use c++11, too.

Maybe this is of interest: https://cmake.org/cmake/help/latest/manual/cmake-compile-features.7.html#id1

Regards, Sebastian

mlampe commented 3 years ago

@stephanmg: There already is ugcore/cmake/ug/cpp11.cmake with the same intent. Wants to be enabled with -DCXX11=ON though.

@sreiter: Seems that this requires a much more recent version of cmake. Currently, we claim to work with 2.6+.

What about defaulting to CXX11=ON as a temporary solution?

stephanmg commented 3 years ago

Thanks for your valuable comments. I'm closing this PR. (Invalid)

@sreiter yeah I know, but I didn't want to depend on a too recent CMake version as @mlampe also confirms.

@mlampe this would have to be changed in the CI too.

LogashenkoDL commented 3 years ago

But we need it under MSWin theoretically, too. Will it work with VS? Is the version 2.6 of cmake an essential requirement?

On 18/09/2020 21:59, mlampe wrote:

@stephanmg https://github.com/stephanmg: There already is /ugcore/cmake/ug/cpp11.cmake/ with the same intent. Wants to be enabled with |-DCXX11=ON| though.

@sreiter https://github.com/sreiter: Seems that this requires a much more recent version of cmake. Currently, we claim to work with 2.6+.

What about defaulting to |CXX11=ON| as a temporary solution?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/UG4/ugcore/pull/37#issuecomment-695034313, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADYRR7XXCI2Z6UZMBXNIBTTSGOU2VANCNFSM4RRRJGUA.

mlampe commented 3 years ago

Will it work with VS?

AppVeyor says yes. That's because VS 2017 defaults to C++14.