[CMake] Project Structure and add_subdirectory()

Marek Vojtko marek.vojtko at oxidegames.com
Mon Sep 30 11:01:45 EDT 2019


> Why would you build targets you don't depend upon in my original proposal? you certainly include them all in your project, but as long as you build your application target, only it's actual dependencies will be built. Of course, if you build the "all" target, everything will be built, but that could easily be avoided with EXCLUDE_FROM_ALL when adding the `components` subdirectory.😊

Unfortunately, we’re using Visual Studio, which makes it very easy to “Build Solution” (which builds all targets, including the CMake-provided ALL_BUILD target), but more cumbersome to build just the application target. There is a default shortcut key for “Build Solution,” but to build just the application you have to use the UI menus :(

Even if the EXCLUDE_FROM_ALL worked – again, I believe Visual Studio’s “Build Solution” just builds all Visual Studio projects that are part of the solution, regardless of what ALL_BUILD does – having to track which libraries should be excluded from the ALL_BUILD target for each application boils down to manually tracking transitive dependencies 😊
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://cmake.org/pipermail/cmake/attachments/20190930/e7413664/attachment-0001.html>


More information about the CMake mailing list