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

New cppstd for apple-clang #3002

Merged
merged 2 commits into from
Feb 21, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 29 additions & 14 deletions reference/config_files/profiles.rst
Original file line number Diff line number Diff line change
Expand Up @@ -41,38 +41,53 @@ and edited later. If you don't specify a *name*, the command will create the ``d
:caption: *Creating the Conan default profile*

$ conan profile detect
Found apple-clang 12.0
apple-clang>=13, using the major as version
Detected profile:
[settings]
arch=x86_64
build_type=Release
compiler=apple-clang
compiler.cppstd=gnu98
compiler.cppstd=gnu17
compiler.libcxx=libc++
compiler.version=12.0
compiler.version=14
os=Macos

WARN: This profile is a guess of your environment, please check it.
WARN: The output of this command is not guaranteed to be stable and can change in future Conan versions
WARN: Defaulted to cppstd='gnu17' for apple-clang.
WARN: The output of this command is not guaranteed to be stable and can change in future Conan versions.
WARN: Use your own profile files for stability.
Saving detected profile to [CONAN_HOME]/profiles/default


.. note:: **A note about the detected C++ standard by Conan**

Conan will always set the default C++ standard as the one that the detected compiler
version uses by default, except for the case of macOS using apple-clang. In this case,
for apple-clang>=11, it sets ``compiler.cppstd=gnu17``. If you want to use a different
C++ standard, you can edit the default profile file directly. First, get the location
of the default profile using:

czoido marked this conversation as resolved.
Show resolved Hide resolved

.. code-block:: bash
:caption: *Creating another profile: myprofile*

$ conan profile detect --name myprofile
Found apple-clang 12.0
Found apple-clang 14.0
apple-clang>=13, using the major as version
Detected profile:
[settings]
arch=x86_64
build_type=Release
compiler=apple-clang
compiler.cppstd=gnu98
compiler.cppstd=gnu17
compiler.libcxx=libc++
compiler.version=12.0
compiler.version=14
os=Macos

WARN: This profile is a guess of your environment, please check it.
WARN: The output of this command is not guaranteed to be stable and can change in future Conan versions
WARN: Defaulted to cppstd='gnu17' for apple-clang.
WARN: The output of this command is not guaranteed to be stable and can change in future Conan versions.
WARN: Use your own profile files for stability.
Saving detected profile to [CONAN_HOME]/profiles/myprofile


Expand Down Expand Up @@ -122,19 +137,19 @@ You can also show the profile's content per context:
arch=x86_64
build_type=Release
compiler=apple-clang
compiler.cppstd=gnu98
compiler.cppstd=gnu17
compiler.libcxx=libc++
compiler.version=12.0
compiler.version=14
os=Macos

Build profile:
[settings]
arch=x86_64
build_type=Release
compiler=apple-clang
compiler.cppstd=gnu98
compiler.cppstd=gnu17
compiler.libcxx=libc++
compiler.version=12.0
compiler.version=14
os=Macos


Expand All @@ -161,9 +176,9 @@ List of settings available from :ref:`reference_config_files_settings_yml`:
arch=x86_64
build_type=Release
compiler=apple-clang
compiler.cppstd=gnu98
compiler.cppstd=gnu17
compiler.libcxx=libc++
compiler.version=12.0
compiler.version=14
os=Macos


Expand Down
15 changes: 7 additions & 8 deletions tutorial/consuming_packages/build_simple_cmake_project.rst
Original file line number Diff line number Diff line change
Expand Up @@ -142,27 +142,26 @@ line. An example of the output of this command for MacOS would be:
arch=x86_64
build_type=Release
compiler=apple-clang
compiler.cppstd=gnu98
compiler.cppstd=gnu17
compiler.libcxx=libc++
compiler.version=14
os=Macos

.. note:: **A note about the detected C++ standard by Conan**

Conan will always set the default C++ standard as the one that the detected compiler
version uses by default. In this case, for apple-clang 14, it sets
``compiler.cppstd=gnu98`` but as we are going to use libraries through the tutorial that
require a higher C++ standard, we have to update our profile to use at least C++ 11. To do
that, you can edit the default profile file directly. First, get the location of the
default profile using:
version uses by default, except for the case of macOS using apple-clang. In this case,
for apple-clang>=11, it sets ``compiler.cppstd=gnu17``. If you want to use a different
C++ standard, you can edit the default profile file directly. First, get the location
of the default profile using:

.. code-block:: bash

$ conan profile path default
/Users/user/.conan2/profiles/default

Then open and edit the file and set ``compiler.cppstd`` to at least C++ 11, by setting
``compiler.cppstd=gnu11`` or ``compiler.cppstd=11``
Then open and edit the file and set ``compiler.cppstd`` to the C++ standard you want
to use.

We will use Conan to install **Zlib** and generate the files that CMake needs to
find this library and build our project. We will generate those files in the folder
Expand Down