title: How to CMake compile a library as part of my app's source and not as static/shared library?
body: <p>I'd like to be able to debug my app at the same time as the library(ies) with <strong>VSCode</strong> and <strong>CLion</strong> using <strong>CMake</strong>.</p>
  <pre><code>.
  +-- lib
  |   +-- CMakeLists.txt
  |   +-- lib.c
  |   +-- lib.h
  +-- app
  |   +-- CMakeLists.txt
  |   +-- app.c
  |   +-- app.h
  </code></pre>
  <p>As an example, let's say I want to compile my app with the <a href="https://fmt.dev/latest/usage.html" rel="nofollow noreferrer">{fmt}</a> library as part of the source of my app, to see the flow inside the fmt lib's codebase when I debug my code.</p>
  <p>Obviously, I don't want to copy all the commands of the cmake file of the lib into my cmake file of my app, a way to link the CMakeLists.txt of the lib to my lib's one would be the best.</p>
  <p>In the end, my app uses the static/shared library but there are already SO questions about that and some examples in the open-source world.</p>
  <p>FYI, my app's source files use <code>#include &lt;lib.h&gt;</code>.</p>
  <h3>Edit:</h3>
  <p>I just wanted to clarify a point, using {fmt} as source is much easier since it can be used as a <em>header-file-only library</em>.</p>