forked from conan-io/conan
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Backport cppstd_flag from Conan 2.x (conan-io#15731)
Add wrapper for cppstd_std with conanfile Signed-off-by: Uilian Ries <[email protected]>
- Loading branch information
1 parent
1763159
commit f71f2d1
Showing
3 changed files
with
29 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
from conan.tools._compilers import cppstd_flag as cppstd_flag_settings | ||
|
||
|
||
def cppstd_flag(conanfile): | ||
""" | ||
Returns flags specific to the C++ standard based on the ``conanfile.settings.compiler``, | ||
``conanfile.settings.compiler.version`` and ``conanfile.settings.compiler.cppstd``. | ||
It also considers when using GNU extension in ``settings.compiler.cppstd``, reflecting it in the | ||
compiler flag. Currently, it supports GCC, Clang, AppleClang, MSVC, Intel, MCST-LCC. | ||
In case there is no ``settings.compiler`` or ``settings.cppstd`` in the profile, the result will | ||
be an **empty string**. | ||
:param conanfile: The current recipe object. Always use ``self``. | ||
:return: ``str`` with the standard C++ flag used by the compiler. e.g. "-std=c++11", "/std:c++latest" | ||
""" | ||
settings = conanfile.settings | ||
return cppstd_flag_settings(settings) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters