Only add targets if dependencies are met
New version of !748 (closed) (rebased branch on master and fixed merge conflict in apps/CMakeLists.txt)
New version of !748 (closed) (rebased branch on master and fixed merge conflict in apps/CMakeLists.txt)