In the library I am using there is a trouble: all paths are relative.
I mean, file from path1/path2/file.h has #include "interface.h", which (interface) is located in anotherpath/anotherpath2/interface.h.
Are there any ways how can I force linker to look for includes in different directories?
The linker couldn't care less for header files. It's the compiler you are looking at. (To be really nitpicking, it's the preprocessor. ;-) )
CMake has the include_directories() command:
include_directories( "anotherpath/anotherpath2" )
This, in ./CMakeLists.txt, would make #include "interface.h" possible.
But is that what you really want? Usually, directories are used to segregate modules. #include "anotherpath/anotherpath2/interface.h" would send a much clearer message as to what is actually included here, and where a human could find that header file to look up its declarations. Perhaps a refactoring of your include statements would be better than to add lots of include directories to the CMake configuration...
Generally speaking, your question gives very little context, so it's hard to give advice.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With