On Sat, Oct 26, 2019 at 9:11 AM Rich von Lehe <rhvonl...@gmail.com> wrote:
> 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. > > For instance: > > ModuleA/CMakeLists.txt: > ------------------------------------ > add_library(moduleA STATIC "") > > add_subdirectory(sub1) > add_subdirectory(sub2) > ------------------------------------------ > > sub1/CMakeLists.txt > ------------------------------ > target_include_directories(moduleA PUBLIC .) > target_sources(moduleA > PRIVATE > src1.cpp > src2.cpp > ) > > target_link_libraries(moduleA > PRIVATE > Qt5::Widgets > Qt5::Qml > moduleB > ) > > sub2/CMakeLists.txt > ------------------------------ > target_include_directories(moduleA PUBLIC .) > target_sources(moduleA > PRIVATE > src1.cpp > src2.cpp > ) > > target_link_libraries(moduleA > PRIVATE > Qt5::Quick > moduleC > ) > ----------------------------------- > > I run cmake --graphviz=project.dot . > > From this, two of the files that comes out are project.dot.moduleA and > project.dot.moduleA.dependers. > > The former is only this: > digraph "GG" { > node [ > fontsize = "12" > ]; > "node190" [ label="moduleA" shape="diamond"]; > } > > There is no mention of the Qt5 or other module dependencies. > > > 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. > > 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. > 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. -- Craig Scott Melbourne, Australia https://crascit.com Get the hand-book for every CMake user: Professional CMake: A Practical Guide <https://crascit.com/professional-cmake/> Consulting services (CMake, C++, build/release processes): https://crascit.com/services
-- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: https://cmake.org/mailman/listinfo/cmake