I'm trying to develop a project in Visual Studio Community 2022 using CMake as my build tool. The project is supposed to use some functionality from the Raspberry Pi Pico SDK (see https://github.com/raspberrypi/pico-sdk), but it could be any other library.
Before that I've used Visual Studio Code as described in the "Quick start" documentation on github, yet I want to use the "normal" Visual Studio for future projects, since it offers some more useful feautres than VS Code does.
The problem I'm facing is that there seems to be no way to include all possible header files via CMake, so that it would be available in VS e.g. for IntelliSense, at least not an as easy and obvious way as in VS Code:
In VS Code I'd use the following configuration in the c_cpp_properties.json
{
"configurations": [
{
"name": "Win32",
"includePath": [
"${workspaceFolder}/**",
"${env:PICO_SDK_PATH}/**"
],
"defines": [],
"compilerPath": "C:/Program Files (x86)/GNU Arm Embedded Toolchain/10 2021.10/bin/arm-none-eabi-gcc",
"cStandard": "gnu17",
"cppStandard": "gnu++14",
"intelliSenseMode": "gcc-arm",
"configurationProvider": "ms-vscode.cmake-tools"
}
],
"version": 4
}
in which the line "includePath": ["${env:PICO_SDK_PATH}/**"]
is crucial, which allows VS Code (or the "C/C++ Extension" I guess) to recursively search for all C (header) files in the SDK and make them available in my project.
Things I've already tried is using CMake's include_directories()
or target_include_directories()
which allows me (as far as I understand) to include single files or directories into the project. Yet I'd have to search every single file from the directory and include it there + if there was a single file I'd want to use (e.g. some high level code for something) it most often depends on multiple other header files, which I'd then have to search for and include manually again... Optionally, I guess, I could include the SDK as a submodule in my project, but still I'd had to include every single thing manually without the possibility of an automatic recursive search.
The 0$ question: Is there any way to do such similar configuration like includePath
in Visual Studio, best via CMake, to recursively include all C files from the SDK in my project?