You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Use C compiler to help scan for header dependencies #2601
This issue was originally created at: 2010-04-01 16:36:16.
This issue was reported by: witkamp.
witkamp said at 2010-04-01 16:36:16
The current scanner implementation uses some partial macro expansion. This is not good enough especially when using the C preproccessor for configuration.
For example:
#defineHEADER "foo.h"
#includeHEADER
The current scanner does not detect "foo.h" as a dependency, and you can imagine more sophisticated macros will not work as well.
This is not that big of a problem until someone tried to build variants. Because the scanner does not find the dependency, it is not copied to the variant_dir and the build fails.
Suggested Solution:
Why not run the compiler in preprocessor only mode and scan that output? This guarantees scons will generate correct dependencies.
gregnoel said at 2010-04-30 17:08:38
Bug party triage. The experimental C/C++ scanner will do this, but its use is undocumented. Steven to document how to use it.
Updating the set of related issues. Yes, the CConditionalScanner handles the specific case stated here.
Since not every compilation system would behave the same way trying to use "the preprocessor" to detect header dependencies, it would be hard to do what this issue requests in a portable way. Recommend rejecting (wontfix) this one.
Updating the set of related issues. Yes, the CConditionalScanner handles the specific case stated here.
Since not every compilation system would behave the same way trying to use "the preprocessor" to detect header dependencies, it would be hard to do what this issue requests in a portable way. Recommend rejecting (wontfix) this one.
Ah, ok. I see a new option, /sourceDependencies, which is much more sophisticated and writes a json file (which must be given as the option-argument). That was introduced, according to an MS blog post, with VS 2019 version 16.7.
Activity
ajf58 commentedon Feb 24, 2018
The ParseDepends function caters for this exact use case. I suggest closing this as "fixed".
bdbaddog commentedon Mar 2, 2018
ParseDepends above is a work around.
Pull request #3053 implements a fuller scanner which should handle the above fully.
mwichmann commentedon Jul 19, 2022
Updating the set of related issues. Yes, the
CConditionalScannerhandles the specific case stated here.Since not every compilation system would behave the same way trying to use "the preprocessor" to detect header dependencies, it would be hard to do what this issue requests in a portable way. Recommend rejecting (wontfix) this one.
bdbaddog commentedon Jul 19, 2022
Which C compilers wouldn't handle this?
mwichmann commentedon Jul 19, 2022
I have no idea how you invoke msvc to spit out header dependencies, I'm not saying it can't.
bdbaddog commentedon Jul 19, 2022
/showIncludes but it goes to stdout while running the compiler.
mwichmann commentedon Jul 19, 2022
Ah, ok. I see a new option,
/sourceDependencies, which is much more sophisticated and writes a json file (which must be given as the option-argument). That was introduced, according to an MS blog post, with VS 2019 version 16.7.