Open Todiq opened 2 weeks ago
Hi @Todiq
I think this is intended behavior of the API. One api is to detect the full version of clang, in your case is 17.0.
Then, Conan default settings might not include certain versions. To map full compiler versions to the actual versions, there is another api called default_compiler_version
, that can be used:
compiler.version={{detect_api.default_compiler_version(compiler, version)}}
This way the api gives power to users that want the full clang version, while allowing to also define the predefined settings.yml default versions with the default Conan compatibility.
Check https://docs.conan.io/2/reference/config_files/profiles.html for more details.
Hello @memsharded,
Thanks for your answer. If the API's goal is to detect the full version, shouldn't it then also add the minor version? I am currently running clang 17.0.3, not 17.0.
compiler.version={{detect_api.default_compiler_version(compiler, version)}}
Thanks for the hint, but I cannot use that as is. In fact, when there are more than one compiler installed, I can't be sure of what the result would be. In my case, it returns msvc's version, which is 194
.
I guess there would be a way in Jinja2's syntax to remove the .0
of 17.0
?
Thanks for the hint, but I cannot use that as is. In fact, when there are more than one compiler installed, I can't be sure of what the result would be. In my case, it returns msvc's version, which is 194.
But you can call it with default_compiler_version(clang, clang_version)
from your code above:
{% set clang, clang_version, clang_exe = detect_api.detect_clang_compiler(compiler_exe="clang") %}
{% set clang_final_version = default_compiler_version(clang, clang_version) %}
...
myproj*/*:compiler.version = {{clang_final_version}}
Thanks for your answer. If the API's goal is to detect the full version, shouldn't it then also add the minor version? I am currently running clang 17.0.3, not 17.0.
To be accurate, Conan default settings define in some cases, as gcc
, both major and major+minor versions:
"10", "10.1", "10.2", "10.3", "10.4", "10.5",
"11", "11.1", "11.2", "11.3", "11.4",
If users want to chose which one of the defaults they use, they can use the one with the minor, or the one returned by default_compiler_version
. It is true that we haven't seen anyone so far that wanted to model down to the patch version of the compiler.
Describe the bug
version: 2.4.1 conan_path: D:\venv\Scripts\conan python version: 3.9.13 sys_version: 3.9.13 (tags/v3.9.13:6de2ca5, May 17 2022, 16:36:42) [MSC v.1929 64 bit (AMD64)] sys_executable: D:\venv\Scripts\python.exe is_frozen: False architecture: AMD64 system version: 10.0.22631 platform: Windows-10-10.0.22631-SP0 system: Windows release: 10 cpu: Intel64 Family 6 Model 186 Stepping 3, GenuineIntel
How to reproduce it
Hello,
I created the following profile in order to try auto-detecting the clang version installed with VS.
Running a
conan install ...
returns:I ran the command into the
Developer Powershell for VS 2022
, otherwiseclang_version
is evaluated toNone
(expected).Would mind having a look? Thanks in advance!