Skip to content

Header files missing in certain cases when add_custom_command() is used. #4099

@chessing-c4

Description

@chessing-c4

Brief Issue Summary

Under some circumstances that I have not been able to nail down, using the "add_custom_command()" causes header files to not show up in the CMake Project Outline in VSCode.

If you clone the "cpp-with-rust" repo from https://github.com/paandahl/cpp-with-rust and then modify the "add_executable()" line in the CMakeList.txt to contain "include/multibuf.h" you will see that multibuf.h doesn't show up in the project outline.

However, if you comment out the "add_custom_command()" block, and set the "${BLOBSTORE_BRIDGE_CPP}" variable to an empty value before the "add_executable()" call, you will see that the header file will show up again.

I have tried a few different permutations of "add_custom_command()" to attempt to narrow down what is happening, but I have been unable to. I DO know that the merge presence of an "add_custom_command()" doesn't cause the breakage. It seems to happen as a result of something that the "cargo" command that is being run does.

CMake Tools Diagnostics

{
  "os": "linux",
  "vscodeVersion": "1.93.1",
  "cmtVersion": "1.19.52",
  "configurations": [
    {
      "folder": "/home/chris/src/libtraceability/t/cpp-with-rust",
      "cmakeVersion": "3.30.2",
      "configured": true,
      "generator": "Ninja",
      "usesPresets": false,
      "compilers": {
        "C": "/usr/bin/gcc",
        "CXX": "/usr/bin/g++"
      }
    }
  ],
  "cpptoolsIntegration": {
    "isReady": true,
    "hasCodeModel": true,
    "activeBuildType": "Debug",
    "buildTypesSeen": [
      "Debug"
    ],
    "requests": [],
    "responses": [],
    "partialMatches": [],
    "targetCount": 1,
    "executablesCount": 1,
    "librariesCount": 0,
    "targets": [
      {
        "name": "cpp_with_rust",
        "type": "EXECUTABLE"
      }
    ]
  },
  "settings": [
    {
      "communicationMode": "automatic",
      "useCMakePresets": "auto",
      "configureOnOpen": true
    }
  ]
}

Debug Log

[main] Configuring project: cpp-with-rust 
[main] Saving open files before configure/build
[driver] Removing /home/chris/src/libtraceability/t/cpp-with-rust/build/CMakeCache.txt
[driver] Removing /home/chris/src/libtraceability/t/cpp-with-rust/build/CMakeFiles
[expand] expanded ${workspaceFolder}/build
[driver] Start configure 
[driver] Running pre-configure checks and steps
[driver] Using compilers in GCC 13.2.0 x86_64-linux-gnu for configure
[expand] expanded ${workspaceFolder}/build
[cmakefileapi-driver] Configuring using kit
[cmakefileapi-driver] Invoking CMake /usr/bin/cmake with arguments ["-DCMAKE_BUILD_TYPE:STRING=Debug","-DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE","-DCMAKE_C_COMPILER:FILEPATH=/usr/bin/gcc","-DCMAKE_CXX_COMPILER:FILEPATH=/usr/bin/g++","-DSKB_TARGET_LIB_DIR=/home/chris/src/skb/lib/x86_64-unknown-linux-gnu","-DSKB_TARGET_INCLUDE_DIR=/home/chris/src/skb/Include","-DUNDEFINED_SANITIZER=On","-DADDRESS_SANITIZER=On","-DPAHO_WITH_SSL=TRUE","-DPAHO_BUILD_SAMPLES=TRUE","--no-warn-unused-cli","-S/home/chris/src/libtraceability/t/cpp-with-rust","-B/home/chris/src/libtraceability/t/cpp-with-rust/build","-G","Ninja"]
[proc] Executing command: /usr/bin/cmake -DCMAKE_BUILD_TYPE:STRING=Debug -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE -DCMAKE_C_COMPILER:FILEPATH=/usr/bin/gcc -DCMAKE_CXX_COMPILER:FILEPATH=/usr/bin/g++ -DSKB_TARGET_LIB_DIR=/home/chris/src/skb/lib/x86_64-unknown-linux-gnu -DSKB_TARGET_INCLUDE_DIR=/home/chris/src/skb/Include -DUNDEFINED_SANITIZER=On -DADDRESS_SANITIZER=On -DPAHO_WITH_SSL=TRUE -DPAHO_BUILD_SAMPLES=TRUE --no-warn-unused-cli -S/home/chris/src/libtraceability/t/cpp-with-rust -B/home/chris/src/libtraceability/t/cpp-with-rust/build -G Ninja
[proc]   with environment: {"CARGO_NET_GIT_FETCH_WITH_CLI":"true","CHROME_DESKTOP":"code-url-handler.desktop","CINNAMON_VERSION":"6.2.9","CLUTTER_IM_MODULE":"ibus","DBUS_SESSION_BUS_ADDRESS":"unix:path=/run/user/1000/bus","DESKTOP_SESSION":"cinnamon","DISPLAY":":1","GDK_BACKEND":"x11","GDMSESSION":"cinnamon","GIO_LAUNCHED_DESKTOP_FILE":"/usr/share/applications/code.desktop","GIO_LAUNCHED_DESKTOP_FILE_PID":"21149","GJS_DEBUG_OUTPUT":"stderr","GJS_DEBUG_TOPICS":"JS ERROR;JS LOG","GNOME_DESKTOP_SESSION_ID":"this-is-deprecated","GPG_AGENT_INFO":"/run/user/1000/gnupg/S.gpg-agent:0:1","GSM_SKIP_SSH_AGENT_WORKAROUND":"true","GTK3_MODULES":"xapp-gtk3-module","GTK_IM_MODULE":"ibus","GTK_MODULES":"gail:atk-bridge","HOME":"/home/chris","LANG":"en_US.UTF-8","LESSCLOSE":"/usr/bin/lesspipe %s %s","LESSOPEN":"| /usr/bin/lesspipe %s","LOGNAME":"chris","ORIGINAL_XDG_CURRENT_DESKTOP":"X-Cinnamon","PATH":"/home/chris/.local/bin:/home/chris/bin:/home/chris/.cargo/bin:/home/chris/.local/bin:/home/chris/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/usr/local/go/bin:/usr/local/go/bin","PWD":"/home/chris","QT_ACCESSIBILITY":"1","QT_IM_MODULE":"ibus","SESSION_MANAGER":"local/chris-Precision-5820-Tower-X-Series:@/tmp/.ICE-unix/3125,unix/chris-Precision-5820-Tower-X-Series:/tmp/.ICE-unix/3125","SHELL":"/bin/bash","SHLVL":"0","SSH_AUTH_SOCK":"/run/user/1000/keyring/ssh","USER":"chris","USERNAME":"chris","VSCODE_AMD_ENTRYPOINT":"vs/workbench/api/node/extensionHostProcess","VSCODE_CODE_CACHE_PATH":"/home/chris/.config/Code/CachedData/38c31bc77e0dd6ae88a4e9cc93428cc27a56ba40","VSCODE_CRASH_REPORTER_PROCESS_TYPE":"extensionHost","VSCODE_CWD":"/home/chris","VSCODE_HANDLES_UNCAUGHT_ERRORS":"true","VSCODE_IPC_HOOK":"/run/user/1000/vscode-3ee20757-1.93-main.sock","VSCODE_NLS_CONFIG":"{\"userLocale\":\"en-us\",\"osLocale\":\"en-us\",\"resolvedLanguage\":\"en\",\"defaultMessagesFile\":\"/usr/share/code/resources/app/out/nls.messages.json\",\"locale\":\"en-us\",\"availableLanguages\":{}}","VSCODE_PID":"21149","WINDOWPATH":"2","XAUTHORITY":"/run/user/1000/gdm/Xauthority","XDG_CONFIG_DIRS":"/etc/xdg/xdg-cinnamon:/etc/xdg","XDG_CURRENT_DESKTOP":"X-Cinnamon","XDG_DATA_DIRS":"/usr/share/gnome:/usr/share/cinnamon:/usr/share/gnome:/home/chris/.local/share/flatpak/exports/share:/var/lib/flatpak/exports/share:/usr/local/share/:/usr/share/","XDG_RUNTIME_DIR":"/run/user/1000","XDG_SEAT":"seat0","XDG_SESSION_CLASS":"user","XDG_SESSION_DESKTOP":"cinnamon","XDG_SESSION_ID":"3","XDG_SESSION_TYPE":"x11","XDG_VTNR":"2","XMODIFIERS":"@im=ibus","_":"/usr/share/code/code","ELECTRON_RUN_AS_NODE":"1","VSCODE_DOTNET_INSTALL_TOOL_ORIGINAL_HOME":"/home/chris","VSCODE_L10N_BUNDLE_LOCATION":""}
[cmake] Not searching for unused variables given on the command line.
[cmake] -- The C compiler identification is GNU 13.2.0
[cmake] -- The CXX compiler identification is GNU 13.2.0
[cmake] -- Detecting C compiler ABI info
[cmake] -- Detecting C compiler ABI info - done
[cmake] -- Check for working C compiler: /usr/bin/gcc - skipped
[cmake] -- Detecting C compile features
[cmake] -- Detecting C compile features - done
[cmake] -- Detecting CXX compiler ABI info
[cmake] -- Detecting CXX compiler ABI info - done
[cmake] -- Check for working CXX compiler: /usr/bin/g++ - skipped
[cmake] -- Detecting CXX compile features
[cmake] -- Detecting CXX compile features - done
[cmake] -- Configuring done (0.5s)
[cmake] -- Generating done (0.0s)
[cmake] -- Build files have been written to: /home/chris/src/libtraceability/t/cpp-with-rust/build
[cmakefileapi-parser] Read reply folder: /home/chris/src/libtraceability/t/cpp-with-rust/build/.cmake/api/v1/reply
[cmakefileapi-parser] Found index files: ["cache-v2-0b8f47cbd1446980a287.json","cmakeFiles-v1-106258fa387a6685486b.json","codemodel-v2-f94df4806e9ab7ec8682.json","directory-.-Debug-f5ebdc15457944623624.json","index-2024-09-27T20-48-29-0661.json","target-cpp_with_rust-Debug-34910e5e8831d632de61.json","toolchains-v1-0dec0620bd9b8879ca34.json"]
[cache] Reading CMake cache file /home/chris/src/libtraceability/t/cpp-with-rust/build/CMakeCache.txt
[cache] Parsing CMake cache string
[extension] [7110] cmake.cleanConfigureAll finished (returned {"result":0,"resultType":0})

Additional Information

No response

Metadata

Metadata

Assignees

Type

No type

Projects

Status

Completed

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions