is there a way to add an include search path(-Imy/filepath) for a specific (or better a group of) c/cpp file?
is there any way to have the -Imy/filepath to be added before the system include sarch paths? i need to override a specific include file. in detail I wish to include my version of pthread.h instead of the one provided by the sdk that under:
I read carefully that page several times before asking my question.
unfortunately build-flags apply to ALL the environment.
my question was if is there a way to specify different sets of flags for different group of files in the same build environment and not for different target environment.
may be I want to specify different include search path for different group of source files to avoid filename conflicts if i am going to integrate some libraries, or i need to specify a log related define (es. -DLOG_DEBUG) only for a specific source…
The flags I have specified above are being applied to the compilation of all the source files for all the libraries, and all of the project source.
I’d like the library to export a few of the include files (those that define the interface to the library), but there are a number of internal header files that I don’t want to be included for the whole project, buy do need to be included in the compilation of the .c files of the library itself.
Thanks for giving me breadcrumbs to follow.
It looks like my issue is related to that one, but not exactly the same. When I dump the env and global_env from the library script, things look alright. The local env contains the CPPPATH files that I included with the flags directive. The global_env only includes the framework include paths.
When I dump the env and global_env from the project build script (with extra_script = pre:script.py), they both only contain the CPPPATH paths from the framework.
However, when I build with -v, the library include paths are still being applied to all the files in the project, including to other libraries…
which suggests that this is not a bug, but by design. I think I can fix the issue by overriding what files are included at what stage, but I’m not sure I understand why all library header files would be prepended into the project env.
Alright, a lot of me posting in one day, but I’ve made progress.
I can trim down my include search paths for the whole project by adding this to the post.py script:
Those directories contain headers that are needed to compile objects in the library, but aren’t required for any code in the project (or libraries that depend on SSISD) to compile. So I can remove them from the include path list for most of the project.
I’m starting to realize that this is somewhat niche requirement. The less hacky alternative is to change the header file include directives from, for example:
This works, and prevents the header conflicts I’m worried about, but it requires modifying almost every file, and for external libraries that’s not a great option.
I think some way to specify this via JSON, instead of via script, would be nice. for example:
I’d like to be able to set up this configuration from the library itself rather than from the global config/script. But for now this solution works. The other option would be to just hardcore all my include paths, which might be the right way to do this anyway.