Skip to content

Switch from SRCS to modular targets

Thiago Sueto requested to merge work/thiagosueto/modularcmake into master

This MR:

  • Switches from using _SRCS (pre-3.0 CMake style) to using only targets (modern CMake) so it's easier to deal with modularity
  • Uses modular design for CMake
  • Moves pics to src/pics to add it to the ktt-general target
  • Moves source code from src/* to src/base since a lot of those are deps for content in folders
  • Creates targets for each folder + a few extras
  • Abstracts all Qt/KF deps away in an INTERFACE target as per DRY rule
  • Switches from unreliable qt_add_resource() to ensure compilation with CMAKE_AUTORCC

This MR is limited to using static libraries because of the high amount of cyclic dependencies. This is not such a problem since it's just an app (not a proper library), but at some point I want to allow shared libs.

Also, while the modern CMake recommendation is "use PRIVATE for implementation-exclusive includes, PUBLIC for implementation + header includes", this only applies to pure libraries, so I left everything in PRIVATE instead.

Advantages:

  • Easier to read
  • Well organized
  • Allows to build only specific targets instead of the whole program (e.g. cmake --build build/ --target ktt-widgets), leading to less compilation time
Edited by Thiago Sueto

Merge request reports