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

Add compile features for cmake 3.8+ #1103

Merged
merged 2 commits into from
Apr 7, 2019
Merged

Add compile features for cmake 3.8+ #1103

merged 2 commits into from
Apr 7, 2019

Conversation

Lectem
Copy link
Contributor

@Lectem Lectem commented Apr 1, 2019

This pull requests adds the minimal requirements of fmtlib to the CMake targets.
This is needed so that the users don't have to do it on all their target linking with fmt::*.
A cmake version check is added since the cxx_std_11 compile feature is not available before CMake 3.8.

Note that without this feature required by the user, such an error can occur:

In file included from /usr/bin/../lib/gcc/x86_64-linux-gnu/6.5.0/../../../../include/c++/6.5.0/type_traits:35:/usr/bin/../lib/gcc/x86_64-linux-gnu/6.5.0/../../../../include/c++/6.5.0/bits/c++0x_warning.h:32:2: error: This file requires compiler and library support for the ISO C++ 2011 standard. This support must be enabled with the -std=c++11 or -std=gnu++11 compiler options.
#error This file requires compiler and library support \

I agree that my contributions are licensed under the {fmt} license, and agree to future changes to the licensing.

Copy link
Contributor

@vitaut vitaut left a comment

Choose a reason for hiding this comment

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

Thanks for the PR. Some comments inline.

CMakeLists.txt Outdated Show resolved Hide resolved
CMakeLists.txt Show resolved Hide resolved
@Lectem
Copy link
Contributor Author

Lectem commented Apr 7, 2019

I did the modifications to require only cxx_auto_type and cxx_variadic_templates.
As a note, I think we could also remove the cxx14.cmake helper and use Conditional Compilation Options instead. (For a later PR?)

Most of the current macros have a mapping:

Supported by Cmake 3.1

  • SUPPORTS_VARIADIC_TEMPLATES > cxx_variadic_macros
  • SUPPORTS_INITIALIZER_LIST > cxx_generalized_initializers
  • SUPPORTS_ENUM_BASE > cxx_strong_enums (a bit more aggressive, but enum base and strongly typed enums are from the same proposal)
  • SUPPORTS_USER_DEFINED_LITERALS > cxx_user_literals

Unsupported by Cmake 3.1

  • SUPPORTS_TYPE_TRAITS

@vitaut vitaut merged commit 6e37c20 into fmtlib:master Apr 7, 2019
@vitaut
Copy link
Contributor

vitaut commented Apr 7, 2019

Merged, thanks!

I think we could also remove the cxx14.cmake helper and use Conditional Compilation Options instead. (For a later PR?)

Good idea.

SUPPORTS_VARIADIC_TEMPLATES can just go away since variadic templates is a hard requirement now.

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.

3 participants