I use the following commands from the command line when inside folder project_folder\build (note that I specify the 64bit architecture in the configure step using -A x64):
cmake .. -G "Visual Studio 17 2022" -A x64 -DCMAKE_TOOLCHAIN_FILE="conan_toolchain.cmake"
cmake --build . --config Release
Now, it seems like cmake doesn't give any information at the build step regarding which architecture this is, it just creates the executable (based on the CMakeLists.txt which just specifies the create an executable) in the Release folder. But when I actually examine the executable in a text-editor, I can see it is still 32 bits (utilizing the trick of looking for PE L which means 32 bits).
I would also add that as a matter of fact when I used conan to get the relevant dependencies before the above commands, I didn't get dependencies for 64 bits, only for 32 bits. But I would at least expect the cmake build command to fail at this stage and tell me it could not find 64 bits dependencies, as I clearly specified that is what I want.
I found out what happend, so I am answering my own question although it did lack some background information as for the output I get or the version I use as drodri pointed out in his comment. But hopefully it can help someone who got a similar problem when working with Conan and CMake.
It turns out that the reason CMake ignored my request for architecture in the configure step (as for -A x64) is that right before running that command I used
conan installto get debug 32 dependencies, and when Conan creates the file conan_toolchain.cmake which I later use in the CMake configure step with-DCMAKE_TOOLCHAIN_FILE="conan_toolchain.cmake"it added to that file the lineset(CMAKE_GENERATOR_PLATFORM "Win32" CACHE STRING "" FORCE)which, it turns out, overrides any of the -A specified. So the solution is basically to have theconan installbe run with the correct architecture right before running CMake, and specifying the -A for architecture is not necessary as it would be overriden anyway.