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.
-- 

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

Reply via email to