Closed CIPop closed 3 years ago
Cmake from Windows Terminal / Powershell works fine.
hmm I was just able to run it fine. Are you able to post what your settings.json
file looks like?
@danewalton the settings.json that is checked in.
To be clear I was able to do the following in the past:
cmake
and cmake-gui
to configure the project.cmake-gui
and VSCode interchangeable. I can do this for our other repo at https://github.com/Azure/azure-iot-sdk-c.
I've already tried to remove the .vscode
folder from master. Even if I do that, VSCode won't pick up my cmake
/cmake-gui
configuration for some reason.
The settings.json from master won't work either. I think this has something to do with how VSCode vs cmake is configuring the project.
Here's settings.json with my changes:
{
"cmake.configureEnvironment": {
"VCPKG_ROOT": "s:\vcpkg",
"VCPKG_DEFAULT_TRIPLET": "x64-windows-static"
},
"cmake.configureSettings": {
"WARNINGS_AS_ERRORS" : "ON",
"TRANSPORT_CURL" : "OFF",
"UNIT_TESTING" : "ON",
"UNIT_TESTING_MOCKS" : "OFF",
"TRANSPORT_PAHO" : "ON",
"PRECONDITIONS" : "ON",
"LOGGING" : "ON"
},
"cmake.debugConfig": {
"env": {
"AZ_IOT_DEVICE_ID": "",
"AZ_IOT_HUB_HOSTNAME": "",
"AZ_IOT_ID_SCOPE": "",
"AZ_IOT_REGISTRATION_ID": "",
"AZ_IOT_DEVICE_X509_CERT_PEM_FILE": "",
"AZ_IOT_DEVICE_X509_TRUST_PEM_FILE": "",
"AZ_IOT_HUB_DEVICE_SAS_KEY": "",
"AZ_IOT_HUB_DEVICE_SAS_KEY_DURATION": ""
}
}
}
This fails with
[main] Configuring folder: c
[proc] Executing command: "c:\Program Files\CMake\bin\cmake.EXE" --no-warn-unused-cli -DWARNINGS_AS_ERRORS:STRING=ON -DTRANSPORT_CURL:STRING=OFF -DUNIT_TESTING:STRING=ON -DUNIT_TESTING_MOCKS:STRING=OFF -DTRANSPORT_PAHO:STRING=ON -DPRECONDITIONS:STRING=ON -DLOGGING:STRING=ON -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE -DCMAKE_BUILD_TYPE:STRING=Debug -Hs:/c -Bs:/c/build -G Ninja
[cmake] Not searching for unused variables given on the command line.
[cmake] CMake Error at C:/Program Files/CMake/share/cmake-3.17/Modules/CMakeDetermineSystem.cmake:99 (message):
[cmake] Could not find toolchain file: s:cpkg/scripts/buildsystems/vcpkg.cmake
[cmake] Call Stack (most recent call first):
[cmake] CMakeLists.txt:47 (project)
[cmake] -- Configuring incomplete, errors occurred!
[cmake]
[cmake]
[cmake] CMake Error: CMake was unable to find a build program corresponding to "Ninja". CMAKE_MAKE_PROGRAM is not set. You probably need to select a different build tool.
[cmake] CMake Error: CMAKE_C_COMPILER not set, after EnableLanguage
Seems at least part of the problem was mismatched compiler version. I updated the instructions in #920 to hopefully call that out and prevent the same in the future.
.vscode
folder is interfering when working in a mixed command-line vs VSCode mode.If I do cmake ..
or ccmake ..
in command line, I expect that VSCode will not alter the configuration.
Closed incorrectly (I missed my comment in the PR).
Original issue was fixed and docs updated by @danewalton :
[variant] Loaded new set of variants
[kit] Successfully loaded 4 kits from C:\Users\crist\AppData\Local\CMakeTools\cmake-tools-kits.json
[main] Configuring folder: c
[cmakefileapi-driver] Removing s:/c/build/CMakeCache.txt
[proc] Executing command: "c:\Program Files\CMake\bin\cmake.EXE" --no-warn-unused-cli -DWARNINGS_AS_ERRORS:STRING=ON -DTRANSPORT_CURL:STRING=OFF -DUNIT_TESTING:STRING=OFF -DUNIT_TESTING_MOCKS:STRING=OFF -DTRANSPORT_PAHO:STRING=OFF -DPRECONDITIONS:STRING=ON -DLOGGING:STRING=ON -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE -DCMAKE_BUILD_TYPE:STRING=Debug -Hs:/c -Bs:/c/build -G Ninja
[cmake] Not searching for unused variables given on the command line.
[cmake] CMake Error at C:/Program Files/CMake/share/cmake-3.17/Modules/CMakeDetermineSystem.cmake:99 (message):
[cmake] Could not find toolchain file: /scripts/buildsystems/vcpkg.cmake
[cmake] Call Stack (most recent call first):
[cmake] CMakeLists.txt:47 (project)
[cmake]
[cmake]
[cmake] -- Configuring incomplete, errors occurred!
[cmake] See also "S:/c/build/CMakeFiles/CMakeOutput.log".
[cmake] CMake Error: CMake was unable to find a build program corresponding to "Ninja". CMAKE_MAKE_PROGRAM is not set. You probably need to select a different build tool.
[cmake] CMake Error: CMAKE_C_COMPILER not set, after EnableLanguage
To fix this, ensure that VSCode selects an x64 cmake toolset. Auto-detect (or not specifying one) will end up using x86 which causes the error above.
@danewalton my original proposal is to rename/remove .vscode
to avoid interference with cmake
as well as personal settings.
I think the checked-in files are only templates and cannot be ported between Win/Lin/Mac configurations as they are defining VCPKG root and triplet.
The issues with the current .vscode/settings.json
are that:
git status
On branch master
Your branch is up to date with 'origin/master'.
Changes not staged for commit:
(use "git add
3. It may interfere/overwrite with other VSCode personalization for this repo.
4. Breaks cmake-gui / ccmake enable/disable feature for options.
Describe the bug CMake from VSCode isn't working anymore.
Exception or Stack Trace The cmake extension doesn't work (previously working fine) in Windows. (original stack/error fixed - see comments for reference).
To Reproduce On Windows + cmake version 3.17.2 + Powershell (Windows Terminal) or cmd.exe: Steps to reproduce the behavior:
Code Snippet
In Windows I do this with
Invoke-BatchScript
, on Linux I dot-source a bash script.\build
folder:cmake ..
orcmake-gui ..
orccmake ..
msbuild /m ./az.sln
ormake -j
\build
).code ..
(Make sure to select an x64 toolset on Windows - autodetect will select the x86 toolset instead.)
Expected behavior VSCode auto-detects and uses the configuration I've specified in command-line.
Actual behavior:
VSCode replaces the configuration specified in command-line.
Screenshots CMake-Gui option-buttons are broken by VSCode, configuration is replaced by something else:
My configuration:![image](https://user-images.githubusercontent.com/8635911/87466143-a4f7f280-c5ca-11ea-9087-76f2316f5cb9.png)
After VSCode configured cmake:![image](https://user-images.githubusercontent.com/8635911/87466050-77ab4480-c5ca-11ea-84b7-a62164f9dd2a.png)
None of the samples are getting built or can be debugged.
Setup (please complete the following information):
Additional context
Information Checklist Kindly make sure that you have added all the following information above and checkoff the required fields otherwise we will treat the issuer as an incomplete report