vscode-cmake-tools
vscode-cmake-tools copied to clipboard
Cross compile for embedded ARM using preset file does not create cacheVariables before calling CMakeLists.txt
Brief Issue Summary
Using cmake --preset debug works from the command line. It does not work from CMake:Configure. Some command line defines provided by preset cacheVariables are not set before calling root CMakeLists.txt. CMakeLists.txt outputs a message which indicates that the define has not been provided. CMakePresets.json CMakeLists.txt arm-none-eabi-gcc.cmake.txt
CMake Tools Diagnostics
{
"os": "win32",
"vscodeVersion": "1.85.1",
"cmtVersion": "1.16.32",
"configurations": [
{
"folder": "e:\\VCU2\\repository\\vcu\\Application\\vcu_app",
"cmakeVersion": "3.27.1",
"configured": true,
"generator": "Ninja",
"usesPresets": false,
"compilers": {}
}
],
"cpptoolsIntegration": {
"isReady": true,
"hasCodeModel": true,
"activeBuildType": "Debug",
"buildTypesSeen": [
"Debug"
],
"requests": [],
"responses": [],
"partialMatches": [],
"targetCount": 5,
"executablesCount": 1,
"librariesCount": 4,
"targets": [
{
"name": "app_assy_lib",
"type": "OBJECT_LIBRARY"
},
{
"name": "app_src_lib",
"type": "OBJECT_LIBRARY"
},
{
"name": "cw_stm32f746_core",
"type": "OBJECT_LIBRARY"
},
{
"name": "stm32CubeF7_core",
"type": "OBJECT_LIBRARY"
},
{
"name": "vcu_app.elf",
"type": "EXECUTABLE"
}
]
},
"settings": [
{
"communicationMode": "automatic",
"useCMakePresets": "auto",
"configureOnOpen": true
}
]
}
Debug Log
[main] Configuring project: vcu_app
[proc] Executing command: "C:\Program Files\CMake\bin\cmake.EXE" --no-warn-unused-cli -DCMAKE_BUILD_TYPE:STRING=Debug -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE -SE:/VCU2/repository/vcu/Application/vcu_app -Be:/VCU2/repository/vcu/Application/vcu_app/build/Debug -G Ninja
[cmake] Not searching for unused variables given on the command line.
[cmake] -- Start of file ARM_TOOLCHAIN_BIN_DIR
[cmake] -- The C compiler identification is unknown
[cmake] -- The CXX compiler identification is unknown
[cmake] CMake Error at CMakeLists.txt:21 (project):
[cmake] The CMAKE_C_COMPILER:
[cmake]
[cmake] /arm-none-eabi-gcc.exe
[cmake]
[cmake] is not a full path to an existing compiler tool.
[cmake]
[cmake] Tell CMake where to find the compiler by setting either the environment
[cmake] variable "CC" or the CMake cache entry CMAKE_C_COMPILER to the full path to
[cmake] the compiler, or to the compiler name if it is in the PATH.
[cmake]
[cmake]
[cmake] CMake Error at CMakeLists.txt:21 (project):
[cmake] The CMAKE_CXX_COMPILER:
[cmake]
[cmake] /arm-none-eabi-g++.exe
[cmake]
[cmake] is not a full path to an existing compiler tool.
[cmake]
[cmake] Tell CMake where to find the compiler by setting either the environment
[cmake] variable "CXX" or the CMake cache entry CMAKE_CXX_COMPILER to the full path
[cmake] to the compiler, or to the compiler name if it is in the PATH.
[cmake]
[cmake]
[cmake] -- Configuring incomplete, errors occurred!
[proc] The command: "C:\Program Files\CMake\bin\cmake.EXE" --no-warn-unused-cli -DCMAKE_BUILD_TYPE:STRING=Debug -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE -SE:/VCU2/repository/vcu/Application/vcu_app -Be:/VCU2/repository/vcu/Application/vcu_app/build/Debug -G Ninja exited with code: 1
Additional Information
No response
Thanks for letting us know @davepregan ! Could you provide a repro project so that we can investigate?
This definitely seems to be stemming from our extension since it reproduces with the extension but not on the command-line, so a repro project would be very useful. Thanks!
Well I don't really understand what is happening here. I started to prepare a repro project and re-ran the generation/build. This time it worked but the command line seems to have changed
[proc] Executing command: "C:\Program Files\CMake\bin\cmake.EXE" -DCMAKE_BUILD_TYPE=Debug -DARM_TOOLCHAIN_BIN_DIR=C:/ST/STM32CubeIDE_1.6.1/STM32CubeIDE/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.11.3.rel1.win32_1.1.100.202309141235/tools/bin "-DGIT_BASH_CMD=C:/Program Files/Git/usr/bin/bash" -DCMAKE_TOOLCHAIN_FILE=E:/VCU2/repository/vcu/Application/vcu_app/arm-none-eabi-gcc.cmake -SE:/VCU2/repository/vcu/Application/vcu_app -BE:/VCU2/repository/vcu/Application/vcu_app/build/debug -G Ninja
Note that --no-warn-unused-cli is missing, along with -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE. Cmake:ExportCompile Commands File is checked in both User and Workspace settings. I don't know what has removed --no-warn-unused-cli