<div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sat, Oct 26, 2019 at 9:11 AM Rich von Lehe <<a href="mailto:rhvonlehe@gmail.com">rhvonlehe@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div style="font-size:small">I am using CMake 3.15.1.  Having found out about some of the changes with 3.13, I've started to take advantage of using 'add_subdirectory()' in certain cases when a module is large and spans multiple source folders.  <br><br></div><div style="font-size:small">For instance:<br><br></div><div style="font-size:small">ModuleA/CMakeLists.txt:<br></div><div style="font-size:small">------------------------------------<br></div><div style="font-size:small">add_library(moduleA STATIC "")<br><br></div><div style="font-size:small">add_subdirectory(sub1)<br></div><div style="font-size:small">add_subdirectory(sub2)<br></div><div style="font-size:small">------------------------------------------<br><br></div><div style="font-size:small">sub1/CMakeLists.txt</div><div style="font-size:small">------------------------------<br></div><div style="font-size:small">target_include_directories(moduleA PUBLIC .)<br></div><div style="font-size:small">target_sources(moduleA</div><div style="font-size:small">   PRIVATE<br></div><div style="font-size:small">        src1.cpp</div><div style="font-size:small">        src2.cpp</div><div style="font-size:small">    )<br><br></div><div style="font-size:small">target_link_libraries(moduleA<br></div><div style="font-size:small">    PRIVATE <br></div><div style="font-size:small">        Qt5::Widgets<br></div><div style="font-size:small">        Qt5::Qml<br></div><div style="font-size:small">        moduleB</div><div style="font-size:small">    )</div><div style="font-size:small"><br></div><div style="font-size:small">sub2/CMakeLists.txt</div><div style="font-size:small">------------------------------</div><div style="font-size:small">target_include_directories(moduleA PUBLIC .)<br></div><div style="font-size:small">target_sources(moduleA</div><div style="font-size:small">    PRIVATE</div><div style="font-size:small">        src1.cpp</div><div style="font-size:small">        src2.cpp</div><div style="font-size:small">    )</div><div style="font-size:small"><br></div><div style="font-size:small">target_link_libraries(moduleA</div><div style="font-size:small">    PRIVATE <br></div><div style="font-size:small">        Qt5::Quick</div><div style="font-size:small">        moduleC</div><div style="font-size:small">    )<br></div><div style="font-size:small">-----------------------------------<br><br></div><div style="font-size:small">I run cmake --graphviz=project.dot .<br></div><div style="font-size:small"><br></div><div style="font-size:small">From this, two of the files that comes out are project.dot.moduleA and project.dot.moduleA.dependers.<br><br></div><div style="font-size:small">The former is only this:<br>digraph "GG" {<br>node [<br>  fontsize = "12"<br>];<br>    "node190" [ label="moduleA" shape="diamond"];<br>}<br><br></div><div style="font-size:small">There is no mention of the Qt5 or other module dependencies.<br></div><div style="font-size:small"><br><br></div><div style="font-size:small">Other modules with dependencies but without the hierarchy introduced with add_subdirectory() seem to be just fine and include their respective dependencies in their project.dot.moduleX files.<br><br></div><div style="font-size:small">Is this a bug or am I misusing add_subdirectory() here?  With the exception of the graphviz output, everything builds and runs as expected with my setup.</div></div></blockquote></div><div><br></div><div>The structure of your project looks fine, it's probably a bug in the graphviz handling. There has been a bit of activity around improving that recently, so it's possible that it has either been broken recently or has been fixed on master already. Can you please try a few earlier CMake versions and see if the problem has always been there? If it looks like a recently introduced regression, please also try a nightly build of the latest master (or build CMake from sources yourself if you're happy to do that). If the bug is still there on master, I suggest you file a bug report.</div><div><br></div>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr">Craig Scott<br><div>Melbourne, Australia</div><div><a href="https://crascit.com" target="_blank">https://crascit.com</a><br></div><div><br></div><div>Get the hand-book for every CMake user: <a href="https://crascit.com/professional-cmake/" target="_blank">Professional CMake: A Practical Guide</a><br></div><div>Consulting services (CMake, C++, build/release processes): <a href="https://crascit.com/services" target="_blank">https://crascit.com/services</a></div></div></div></div></div></div></div></div></div></div></div></div>