If the original problem was that the project wasn't producing installable output or wasn't placing it in the right location, explicitly setting CMAKE_INSTALL_PREFIX ensured that cmake --install . knew exactly where to place files.
This pattern avoids cluttering the source directory and ensures a clean separation between source, build artifacts, and install files.