Issue
I am using cmake, mostly on windows. I wanted to test compiling on linux and for that I wanted to use WSL.
I correctly (i think) setup the CMake Tools extension for Remote: WSL, cmake is installed on wsl, too.
The settings.json
of the cmake extension for WSL (Remote: WSL
) looks like this:
"cmake.configureArgs": [
"-DVCPKG_TARGET_TRIPLET=x64-linux",
"-DCMAKE_TOOLCHAIN_FILE=/home/raildex/downloads/vcpkg/scripts/buildsystems/vcpkg.cmake"
],
"cmake.cmakePath": "/home/raildex/downloads/cmake/bin/cmake"
The settings.json
of the cmake extension for Windows (Workspace
) looks like this:
"cmake.configureArgs": [
"-DCMAKE_TOOLCHAIN_FILE=D:\\Dokumente\\Repositories\\vcpkg\\scripts\\buildsystems\\vcpkg.cmake",
"-DVCPKG_TARGET_TRIPLET=x86-windows"
]
When I use the command CMake: Configure
within a WSL remote connection, it looks for the toolchain file on my Windows directory:
[proc] Executing command: /home/raildex/downloads/cmake/bin/cmake --no-warn-unused-cli -DCMAKE_TOOLCHAIN_FILE=D:\Dokumente\Repositories\vcpkg\scripts\buildsystems\vcpkg.cmake -DVCPKG_TARGET_TRIPLET=x86-windows -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE -DCMAKE_BUILD_TYPE:STRING=Debug -DCMAKE_C_COMPILER:FILEPATH=/usr/bin/gcc -DCMAKE_CXX_COMPILER:FILEPATH=/usr/bin/g++ -S/mnt/d/Dokumente/Repositories/Project -B/mnt/d/Dokumente/Repositories/Project/build -G Ninja
It runs cmake from WSL, but the configuration is for Windows?
What am I missing?
Solution
The issue was that the settings of the workspace override the settings of the remote connection.
The order of overriding is User < Remote < Workspace
My (temporary) solution is to set the cmake options for Windows in the User Settings and keep the Workspace Settings empty.
Answered By - Raildex Answer Checked By - Senaida (WPSolving Volunteer)