HomePhabricator
Diffusion Comm 966d8e06644e

[services] Expose top-level CMakeList.txt for cpp projects

Description

[services] Expose top-level CMakeList.txt for cpp projects

Summary:
A top-level CMakeList.txt is required
because CMake does not like importing from sibling directories.
Instead it's best practices to have CMake add the
related subdirectories, and then add the link dependencies
from the parent directory.

This is part of a larger effort to bring more structure to the C++ codebase https://linear.app/comm/issue/ENG-1310/export-nativecpp-projects-as-cmake-projects

The intent is to be able to reference the dependencies as packages, instead of just as GLOB'ing over certain directories; which is a major anti-pattern in CMake as it create a bunch of footguns such as finding multiple files with main() defined, or picking up unrelated code in generated folders.

Test Plan:

nix develop
cd native/cpp/CommonCpp/
rm -rf build && mkdir build && cd build && cmake .. && make -j
# should build everything under CommonCpp

Reviewers: max, karol, atul, varun

Reviewed By: atul

Subscribers: ashoat, tomek, adrian, atul, abosh

Differential Revision: https://phab.comm.dev/D4297

Details

Provenance
jonAuthored on Jun 19 2022, 11:43 AM
Reviewer
atul
Differential Revision
D4297: [services] Expose top-level CMakeList.txt for cpp projects
Parents
rCOMM6fd60d534f87: [services] Export DatabaseManagers as CMake Project
Branches
Unknown
Tags
Unknown