如何 运行 "conan init" 并禁用有关 GCC ABI (libstdc++11) 兼容性的警告?

How do I run "conan init" and disable the warning about GCC ABI (libstdc++11) compatibility?

每次我 运行 conan init 在新的 docker 容器中,我都会收到以下警告:

************************* WARNING: GCC OLD ABI COMPATIBILITY ***********************

Conan detected a GCC version > 5 but has adjusted the 'compiler.libcxx' setting to
'libstdc++' for backwards compatibility.
Your compiler is likely using the new CXX11 ABI by default (libstdc++11).

If you want Conan to use the new ABI for the default profile, run:

    $ conan profile update settings.compiler.libcxx=libstdc++11 default

Or edit '/home/smith/.conan/profiles/default' and set compiler.libcxx=libstdc++11

************************************************************************************

这很烦人,而且让人分心。同样冗余,因为脚本中的 very 下一个命令 I 运行 是用于设置 ABI 的命令,正如警告中所建议的那样。

conan profile update settings.compiler.libcxx=libstdc++11 default

有没有办法禁用警告以避免看到它?

我能找到的最好方法是使用更多命令,并手动指定值。但是后来我失去了编译器类型和版本的自动检测。

而不只是:

conan init

我必须创建一个配置文件并填写以下值:

conan profile new default
conan profile update settings.os=Linux default
conan profile update settings.os_build=Linux default
conan profile update settings.arch=x86_64 default
conan profile update settings.arch_build=x86_64 default
conan profile update settings.compiler=gcc default
conan profile update settings.compiler.version=9 default
conan profile update settings.compiler.libcxx=libstdc++11 default
conan profile update settings.build_type=Release default

运行 有很多命令。如果您正在查看并认为这是个好主意,我建议您也查看 conan config install,以从另一个文件加载配置文件。

CONAN_V2_MODE 开启时可以跳过此警告:例如:

conan:~$ export CONAN_V2_MODE=1
conan:~$ conan config init
WARN: Remotes registry file missing, creating default one in /home/conan/.conan/remotes.json
Auto detecting your dev setup to initialize the default profile (/home/conan/.conan/profiles/default) 
Found gcc 9.2
gcc>=5, using the major as version
gcc C++ standard library: libstdc++11
Default settings
    os=Linux
    os_build=Linux
    arch=x86_64
    arch_build=x86_64
    compiler=gcc
    compiler.version=9
    compiler.libcxx=libstdc++11
    build_type=Release
*** You can change them in /home/conan/.conan/profiles/default ***
*** Or override with -s compiler='other' -s ...s***

但该变量还会激活其他一些柯南 v2 选项。您可以在这里阅读更多内容:https://docs.conan.io/en/latest/reference/conan_v2_mode.html