Open chessing-c4 opened 1 month ago
The add_custom_command
statement is missingBYPRODUCTS
if you're using ninja.
Also i don't see a header file getting passed to add_executable
. Is it generated by the call to add_custom_command
? Or is it just the .cc file itself?
And it might be worth a look at dependency chains if you're generating code.
Maybe this solves your problem
@gcampbell-msft I was able to reproduce this issue using a user supplied project, here are the detailed steps to reproduce it:
Repro steps:
include/multibuf.h
Set BLOBSTORE_BRIDGE_CPP to null before the add_executable line
@kuch3n The reproduction step of chessing-c4 has at the “add_executable()” line add include/multibuf.h, when I add the BYPRODUCTS attribute to add_custom_command the problem still reproduces, can you give us some suggestions? Can you give us some suggestions?
It looks like no headers are shown at all if a header is missing at configure time. Even if headers are touched at configure time, they're still missing in the outline.
If the generated header is not given as as source, other headers show up again. Compare targets test_with_generated
and test
.
I've added ./src/main.h
manually to show above behaviour.
The api reply even lists the generated header filer:
{
"backtrace" : 1,
"isGenerated" : true,
"path" : "build/src/main.rs.h",
"sourceGroupIndex" : 0
},
{
"backtrace" : 1,
"path" : "src/main.h",
"sourceGroupIndex" : 0
},
The difference is the isGenerated
key
I've deleted all isGenerated
keys, restarted VSCode and the "missing" headers show up in the project outline.
So if you specify sources which are genearted by, e.g., OUTPUT
or BYPRODUCTS
, above key gets set and the project outline gets borked.
@chessing-c4 @kuch3n Reading through the above investigation, would it be correct to say that this issue is a request to show generated headers in the project outline?
@gcampbell-msft I don't believe that is correct from my perspective. In my case, none of the header files from the project show up. It doesn't matter if they were generated or not. Honestly, I am less concerned about the generated ones, and more interested in the ones that exist as part of the static source tree.
I will try to find a few minutes today to do what @kuch3n mentioned and see if that resolves the issue. But, from what he describes, it sounds like it might. (If I follow what @kuch3n is saying, they are saying that when "isGenerated" shows up in that file, none of the headers show up. Which is what I am seeing. Or, more specifically, "the project outline gets borked."
Interesting, okay, sounds like it definitely warrants investigation, I'll mark it down for investigation and put it in the backlog.
yes, as soon as the isGenerated
key shows up in the API response, no header shows up at all for a target containing generated files.
If you manually delete those keys and restart visual studio code, all headers, including those generated, show up again.
@kuch3n Thank you very much for your reply, our developers are investigating this issue and we'll update the review with any results as soon as we have them.
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
Debug Log
Additional Information
No response