I am trying to configure my project to create several dynamic libraries that encompass its full functionality. There are subfolders for each library. Subfolder libraries are interdependent, so they must reference functions from each other. It seems that I managed to get CMake to work without errors in the project, but when I go to the build, I have problems with my headers that found each other. It seems that the switch path is not configured correctly during assembly. How can i fix this? Are additional steps required to properly configure the enable path?
The structure looks something like this:
root CMakeLists.txt bin lib lib0 CMakeLists.txt lib0.h lib0.cpp lib1 CMakeLists.txt lib1.h lib1.cpp ...
In CMakeLists.txt for the root directory, I have these declarations:
set(ROOT /blah/blah/root) include_directories(${ROOT}/lib0) include_directories(${ROOT}/lib1) add_subdirectory(lib0) add_subdirectory(lib1)
In CMakeLists.txt for subfolders, I have:
set(lib0_SOURCES "") list(APPEND lib0_SOURCES lib0.cpp) add_library(lib0_lib ${lib0_SOURCES})
And my library headers look like (suppose it's lib0.h):
#include "lib1/lib1.h" ...
CMake works fine, without errors, but when I go to compilation, I get an error, for example:
In file included from /blah/blah/root/lib0/lib0.cpp:1:0: /blah/blah/root/lib0/lib0.h:1:30: fatal error: lib1/lib1.h: No such file or directory
source share