I'm developing a C++ project in Linux using CMake.
I am creating two libraries, LibA and LibB. I do not want LibA and LibB to have the same include directories. Is there any way I can set only LibA to include DirectoryA and set only LibB to include DirectoryB?
Edit:
Both LibA and LibB will be used in an executable, MyExe. When I #include LibA.h and LibB.h in MyExe's source code, I cannot have the included header files from DirectoryA and DirectoryBcoexisting in MyExe, as this will create namespace conflicts.
Is this possible?
Edit 2 : Here is my CMakeLists.txt include_directories(include)
add_library(LibA src/LibA.cpp include/LibA.h) set_property(TARGET LibA PROPERTY INCLUDE_DIRECTORIES /opt/SomeLibrary2.0/include/) target_link_libraries(LibA /opt/SomeLibrary2.0/lib/a.so /opt/SomeLibrary2.0/lib/b.so /opt/SomeLibrary2.0/lib/c.so) add_library(LibB src/LibB.cpp include/LibB.h) set_property(TARGET LibB PROPERTY INCLUDE_DIRECTORIES ${LIB_B_INCLUDE_DIRS}) target_link_libraries(LibB ${LIB_B_LIBRARIES}) add_executable(MyExe src/myexe.cpp) target_link_libraries(MyExe LibA LibB) But I'm still getting errors. LibA.h says that SomeLibrary's header files cannot be found?
I cannot have the included header files from DirectoryA and DirectoryB coexisting in MyExe, as this will create namespace conflictsIMHO it is design issue, if you solve include conflicts you may have strange linker errors and unexpected runtime behaviour