Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

issue with presets (v3) and "toolchainFile" #2179

Closed
anb0s opened this issue Oct 15, 2021 · 6 comments
Closed

issue with presets (v3) and "toolchainFile" #2179

anb0s opened this issue Oct 15, 2021 · 6 comments

Comments

@anb0s
Copy link

anb0s commented Oct 15, 2021

Brief Issue Summary

We are using the version 1.9.0 for CMake presets v3 support and instead of:

      "cacheVariables": {
        "CMAKE_TOOLCHAIN_FILE": "cmake/toolchains/linux_gcc_x86_64_x32.cmake"
      }

with the output:

[proc] Executing command: /usr/bin/cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_TOOLCHAIN_FILE=cmake/toolchains/linux_gcc_x86_64_x32.cmake -H/home/andre/git/project -B/home/andre/git/project/build/default -G Ninja
[cmake] -- The C compiler identification is GNU 10.2.1
[cmake] -- The CXX compiler identification is GNU 10.2.1

now we want to use toolchainFile:

     "toolchainFile": "cmake/toolchains/linux_gcc_x86_64.cmake"

and here we are facing the issue:

[proc] Executing command: /usr/bin/cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_TOOLCHAIN_FILE="cmake/toolchains/linux_gcc_x86_64_x32.cmake" -H/home/andre/git/project -B/home/andre/git/project/build/default -G Ninja
[cmake] CMake Error at /usr/share/cmake-3.21/Modules/CMakeDetermineSystem.cmake:130 (message):
[cmake]   Could not find toolchain file:
[cmake]   "cmake/toolchains/linux_gcc_x86_64_x32.cmake"
[cmake] Call Stack (most recent call first):
[cmake]   CMakeLists.txt:3 (project)

It looks like the parameter is now passed still as -DCMAKE_TOOLCHAIN_FILE= but with quotes and something is different at command line, here the both variants are working...

@bobbrow
Copy link
Member

bobbrow commented Oct 15, 2021

Can you try:

"toolchainFile": "${sourceDir}/cmake/toolchains/linux_gcc_x86_64.cmake"

@anb0s
Copy link
Author

anb0s commented Oct 15, 2021

Yes, sure, i've already tried, but same result:

[proc] Executing command: /usr/bin/cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_TOOLCHAIN_FILE="/home/andre/git/project/cmake/toolchains/linux_gcc_x86_64_x32.cmake" -H/home/andre/git/project -B/home/andre/git/project/build/default -G Ninja
[cmake] CMake Error at /usr/share/cmake-3.21/Modules/CMakeDetermineSystem.cmake:130 (message):
[cmake]   Could not find toolchain file:
[cmake]   "/home/andre/git/project/cmake/toolchains/linux_gcc_x86_64_x32.cmake"
[cmake] Call Stack (most recent call first):
[cmake]   CMakeLists.txt:3 (project)

@anb0s
Copy link
Author

anb0s commented Oct 15, 2021

I'm curious why it works in bash:

/usr/bin/cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_TOOLCHAIN_FILE="cmake/toolchains/linux_gcc_x86_64_x32.cmake" -H/home/andre/git/project -B/home/andre/git/project/build/default -G Ninja
-- The C compiler identification is GNU 10.2.1
-- The CXX compiler identification is GNU 10.2.1

P.S.. i have created an issue at CMake first, but if it's working in bash, what is the defference?

@anb0s anb0s changed the title isses with presets (v3) and "toolchainFile" issue with presets (v3) and "toolchainFile" Oct 15, 2021
@bobbrow
Copy link
Member

bobbrow commented Oct 15, 2021

I took a look at the code and it looks like that cmake command is not run in a shell context, so the quotes added after the = are incorrect. I opened a PR to fix it. I'll share an internal build afterward if you would like one, or you can continue setting CMAKE_TOOLCHAIN_FILE in the cacheVariables section until we release 1.9.1 which will contain some other patches.

@anb0s
Copy link
Author

anb0s commented Oct 17, 2021

Thanks, i'm fine with waiting and test 1.9.1 then.

@bobbrow bobbrow modified the milestones: On Deck, 1.9.1 Oct 22, 2021
@andreeis
Copy link
Contributor

@anb0s, a fix for this problem was included in the CMake Tools 1.9.1 release. Upgrade your extension in VSCode and let us know if you encounter any other issues.

@github-actions github-actions bot locked and limited conversation to collaborators Jan 29, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants