You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Finally (and due to conan1-freeze 😉) I had time to migrate from conan1 to conan2.
I'm using a Visual Studio 2022 CMake project with WSL2 (and/or devcontainers). You can find a demo migration project here: https://github.com/steinerthomas/vs-cmake-conan-wsl-template
Debugging/Running the program/tests "native" in WSL2 with the default profile (or in the devcontainers) works well (see example preset wsl-debug).
Unfortunately I can't cross-compile (or cross-debug on remote machines) to other architectures (see example preset remote-debug-showcase) with cmake-conan, because the conan generated presets are not used and so for example linking fails: https://github.com/steinerthomas/vs-cmake-conan-wsl-template/pull/3/files
See Visual Studio build logs
Starting copying files to remote machine.
Copying 'C:\vs-cmake-conan-wsl-template\conanfile.py' to '/home/thomas/.vs/vs-cmake-conan-wsl-template/conanfile.py'.
Finished copying files (elapsed time 00h:00m:00s:163ms).
cd /home/thomas/.vs/vs-cmake-conan-wsl-template//out/build/remote-debug-showcase;export CMAKE_BUILD_PARALLEL_LEVEL=8;export REMOTE_DEBUG_MACHINE=192.168.110.10;/usr/bin/cmake --build /home/thomas/.vs/vs-cmake-conan-wsl-template//out/build/remote-debug-showcase --config Debug;
[ 25%] Building CXX object CMakeFiles/MyLib.dir/src/MyLib.cpp.o
[ 50%] Linking CXX static library libMyLib.a
[ 50%] Built target MyLib
[ 75%] Linking CXX executable MyLib_ut
/usr/bin/ld: /home/thomas/.conan2/p/b/libxm740122de5cf93/p/lib/libxml2.so: error adding symbols: file in wrong format
collect2: error: ld returned 1 exit status
gmake[2]: *** [tests/CMakeFiles/MyLib_ut.dir/build.make:102: tests/MyLib_ut] Error 1
gmake[1]: *** [CMakeFiles/Makefile2:882: tests/CMakeFiles/MyLib_ut.dir/all] Error 2
gmake: *** [Makefile:101: all] Error 2
Build All failed.
Due to the described problem I can't use cmake-conanconan_provider.cmake because I already have CMakePresets.json in my projects and I can't include the conan generated once.
As a workaround I've created my own conan cmake install wrapper, which basically calls conan install before cmake"CMAKE_PROJECT_INCLUDE_BEFORE": "$env{HOME}/.conan2/extensions/cmake/conan_install.cmake" and set the conan generated toolchain"toolchainFile": "${sourceDir}/out/build/${presetName}/build/Debug/generators/conan_toolchain.cmake":
I know I could also invoke conan install manually, but especially in devcontainers it would be annoying switching beteween muliple target architectures ...
I know there are existing issues: #569, #544
But I think the problem there was the cyclic cache generation which is not a problem anymore with WSL2 (see #544 (comment)).
I hope I could describe my problem in detail.
Maybe I missed something and you can help me out, or probably you have a better idea how to use cmake-conan with existing CMakePresets.
The text was updated successfully, but these errors were encountered:
Finally (and due to conan1-freeze 😉) I had time to migrate from conan1 to conan2.
I'm using a Visual Studio 2022 CMake project with WSL2 (and/or devcontainers). You can find a demo migration project here: https://github.com/steinerthomas/vs-cmake-conan-wsl-template
Debugging/Running the program/tests "native" in WSL2 with the
default
profile (or in the devcontainers) works well (see example presetwsl-debug
).Unfortunately I can't cross-compile (or cross-debug on remote machines) to other architectures (see example preset
remote-debug-showcase
) with cmake-conan, because the conan generated presets are not used and so for example linking fails:https://github.com/steinerthomas/vs-cmake-conan-wsl-template/pull/3/files
See Visual Studio build logs
Due to the described problem I can't use
cmake-conan
conan_provider.cmake because I already haveCMakePresets.json
in my projects and I can't include the conan generated once.As also described here https://docs.conan.io/2.12/integrations/visual_studio.html#conan-extension-for-visual-studio:
For CMake-based projects, please refer to the https://github.com/conan-io/cmake-conan.
As a workaround I've created my own conan cmake install wrapper, which basically calls conan install before cmake
"CMAKE_PROJECT_INCLUDE_BEFORE": "$env{HOME}/.conan2/extensions/cmake/conan_install.cmake"
and set the conan generated toolchain"toolchainFile": "${sourceDir}/out/build/${presetName}/build/Debug/generators/conan_toolchain.cmake"
:conan_install.cmake:
I know I could also invoke
conan install
manually, but especially in devcontainers it would be annoying switching beteween muliple target architectures ...I know there are existing issues: #569, #544
But I think the problem there was the cyclic cache generation which is not a problem anymore with WSL2 (see #544 (comment)).
I hope I could describe my problem in detail.
Maybe I missed something and you can help me out, or probably you have a better idea how to use
cmake-conan
with existing CMakePresets.The text was updated successfully, but these errors were encountered: