Open elvisdukaj opened 1 month ago
I am not fully sure if the issue is conan
or CMake
or MSVC
side. Interestingly, calling conan build .
activates the right environment and I don't have this issue.
There is also a relate MR in CMake: VS: Fix '-T version=14.4x' under VS 17.1x
Looking at <Microsoft Visual Studio>/2022\Professional\VC\Auxiliary\Build\vcvarsall.bat
I found:
Looking at conanvcvars.bat
the right environment is called:
@echo off
set __VSCMD_ARG_NO_LOGO=1
set VSCMD_SKIP_SENDTELEMETRY=1
echo conanvcvars.bat: Activating environment Visual Studio 17 - amd64 - winsdk_version=None - vcvars_ver=14.4
set "VSCMD_START_DIR=%CD%" && call "C:\Program Files\Microsoft Visual Studio\2022\Professional\VC/Auxiliary/Build/vcvarsall.bat" amd64 -vcvars_ver=14.4
Indeed in C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Auxiliary\Build\vcvarsall.bat
there is no -vcvars_ver=14.3
option:
Syntax:
vcvarsall.bat [arch] [platform_type] [winsdk_version] [-vcvars_ver=vc_version] [-vcvars_spectre_libs=spectre_mode]
where :
[arch]: x86 | amd64 | x86_amd64 | x86_arm | x86_arm64 | amd64_x86 | amd64_arm | amd64_arm64
[platform_type]: {empty} | store | uwp
[winsdk_version] : full Windows 10 SDK number (e.g. 10.0.10240.0) or "8.1" to use the Windows 8.1 SDK.
[vc_version] : {none} for latest installed VC++ compiler toolset |
"14.0" for VC++ 2015 Compiler Toolset |
"14.xx" for the latest 14.xx.yyyyy toolset installed (e.g. "14.11") |
"14.xx.yyyyy" for a specific full version number (e.g. "14.11.25503")
[spectre_mode] : {none} for libraries without spectre mitigations |
"spectre" for libraries with spectre mitigations
The store parameter sets environment variables to support Universal Windows Platform application
development and is an alias for 'uwp'.
For example:
vcvarsall.bat x86_amd64
vcvarsall.bat x86_amd64 10.0.10240.0
vcvarsall.bat x86_arm uwp 10.0.10240.0
vcvarsall.bat x86_arm onecore 10.0.10240.0 -vcvars_ver=14.0
vcvarsall.bat x64 8.1
vcvarsall.bat x64 store 8.1
Hi @elvisdukaj
I think the problem is that the compiler version 194, with toolset version 14.4 uses the toolset platform v143, so this looks correct in that regard.
the problem could be that you are not calling the generated build/Release/generators/conanbuild.bat
, which is necessary for Ninja
generator. Unless you really don't want to use the Ninja
generator, it is not clear if that profile is the default one, or you are not really calling it, because calling with -s compiler.version=194
seems pointless if it is already defined in the profile.
@memsharded thank you for the reply. I am still a bit puzzled: I never called the conanbuild.bat
when using the cmake preset, as it was working out of the box and cmake or ninja were automatically detecting the msvc toolset. Maybe I was doing that erroneously.
The fact that CLion fails to configure cmake because of the preset could be a bug CLion side than.
Thank you for following up.
For reference I am posting the full profile I used:
======== Input profiles ========
Profile host:
[settings]
arch=x86_64
build_type=Release
compiler=msvc
compiler.cppstd=23
compiler.runtime=dynamic
compiler.runtime_type=Release
compiler.version=194
os=Windows
[tool_requires]
*: ninja/1.12.1, cmake/3.30.1
[conf]
tools.cmake.cmaketoolchain:generator=Ninja
tools.env.virtualenv:powershell=False
Profile build:
[settings]
arch=x86_64
build_type=Release
compiler=msvc
compiler.cppstd=14
compiler.runtime=dynamic
compiler.runtime_type=Release
compiler.version=193
os=Windows
[conf]
tools.cmake.cmaketoolchain:generator=Ninja
tools.env.virtualenv:powershell=True
I have similar results also when using "Visual Studio 17 2022" as cmake generator.
The fact that CLion fails to configure cmake because of the preset could be a bug CLion side than.
It depends on how you use it. If you do it via CMakePresets
it is different than done by the CLion plugin.
The CMake presets might contain the necessary information to locate the tool-requires too.
What is exactly the full failure?
Because I see that you have in your "build" profile: compiler.version=193
, which would be incorrect, if the thing fails to build a tool_requires
in the build context, that would explain it.
If you post the full output of conan install . -s compiler.version=194
that would help
I have the same problem today.
Now, I want to upgrade my visual studio 2022 to 17.11, and I aslo want to use clion as my IDE. What can I do to make it work. Thanks a lot!
I found a way to temporarily solve this problem: To write your own preset in the CMakeUserPresets.json and change the tooleset.value to v144. And Clion works!
Hi @fancygit
I am not sure it is exactly the same issue as @elvisdukaj had compiler.version=193
, which was incorrect, but it seems you have the correct one compiler.version=194
. I think it might be better if you post it as a new issue, please add also:
CMakePresets.json
when you run the conan install
commandconan_toolchain.cmake
when you run the conan install
command.cmake --preset ...
and cmake --build --preset ...
commandsHi @fancygit
I am not sure it is exactly the same issue as @elvisdukaj had
compiler.version=193
, which was incorrect, but it seems you have the correct onecompiler.version=194
. I think it might be better if you post it as a new issue, please add also:
- The produced
CMakePresets.json
when you run theconan install
command- The produced
conan_toolchain.cmake
when you run theconan install
command.- What happens if you run repeated times in the command line the
cmake --preset ...
andcmake --build --preset ...
commands
OK, I will post a new issue.
Describe the bug
After updating Visual Studio my conan projects based on Conan broke during the building because the Visual C++ runtime was not found. The new Visual C++ toolset is v194 but when calling conan install the generated CMakePreset.json still refers to the older toolchain:
Trying to call cmake with the preset results in the following error:
In CLion, instead the fails to load the cmake configuration because is passing
-vcvars_ver=14.3
instead ofvcvarsall.bat" amd64 -vcvars_ver=14.4
On CLion, if I manually changing the toolset value in the generated cmake user preset to
v194
, the configuration works again. This is not true when callingcmake --preset conan-release
.How to reproduce it
Install the latest Visual C++ toolchain (
_MSC_VER 1941
) coming with Visual Studio 17.11.4.Use the following profile:
Create a project with
conan new cmake_exe -d name=msvc194 -d version=1
Call conan install:
conan install . -s compiler.version=194
Calling cmake with the preset:
cmake --preset conan-release