Hello,<br><br>I have the cmake book and have not found how to do what I need, if it is possible.<br>I have a large project that must compile for both Linux and Windows. The project is mostly header-only (except for unit tests) and categorized and organized into subdirectories. Something like this:<br>
<br>build/<br>src/<br> utils<br> a<br> A.h<br> unittest_a.cpp<br><br> b<br> B.h // needs a.h<br> unittest_b.cpp<br>
<br> common<br> c<br> C.h // needs A.h and B.h<br> testit.cpp // needs C.h, B.h and A.h<br><br><br>The directory src/utils/a has a header file A.h. Likewise src/utils/b has a header file B.h that #includes a.h.<br>
Finally, c has a header file C.h that #includes a.h and b.h.<br><br><br>This is just a short example of my large project. In reality there are other directories and levels of subdirectories.<br><br>What can I do in the local CMakeLists.txt files so that the directories where the header files live are automatically made part of the others as needed,<br>
so I do not have to keep remembering all of them for every header-only library all the way down the dependency chain?<br><br>I tried using add_custom_target(...) to create a header-only library target for "a" and "b", then tried add_dependencies() for b (which needs a) and for c(which needs b and by extension also needs a). This fails and in the build directory if I do "cmake .." followed by "VERBOSE=1" make it fails in src/common/c because there is no -Ia -Ib in the compile line.<br>
<br>I have attached this small example to this email though I don't know if the mailman can handle attachments.<br><br>I hope all is clear.<br><br>Thanks for your kind assistance!<br>Vic<br>