Use SC::Build in another repository when you want a small C++ build description, direct native builds, and optional access to the Sane C++ libraries without copying this repository's project structure.
An external project owns its SC-build.cpp. The launcher finds a compatible SaneCppLibraries checkout, compiles the build description, and executes the requested action from the external project directory.
The launcher resolves the requested SaneCppLibraries revision, compiles the project's definition when necessary, and then builds the selected target. The project remains the entry point throughout that process.
The external project remains in control of its sources and revision pin. SaneCppLibraries supplies the build API, bootstrap, and any libraries selected by the definition.
Start with this layout:
SC-build.cpp:
Source/main.cpp:
addSaneCppLibraries adds the public include directory and the unity-build library source. Pass Libraries::Multiple as its third argument only when you specifically want separate library compilation.
There are three useful layouts. Choose one deliberately rather than letting local machine state decide.
Keep SaneCppLibraries below the project, for example ThirdParty/SaneCppLibraries. This is easy to inspect and works without network access after checkout, but updating the dependency changes the project tree.
Point the launcher at an existing checkout while developing both projects together:
This is convenient for local development. It is not a reproducible dependency declaration by itself.
Download the small launcher into the project and let it maintain one shared clone plus versioned worktrees in the user cache. This keeps the dependency outside the project while allowing the revision pragma to select an exact checkout.
On Windows, download SC-build.ps1; SC-build.bat is a wrapper for command-prompt use.
The cache flow reads a pragma near the top of SC-build.cpp:
A branch is useful while collaborating on active development. A tag or commit SHA is a better choice when another person or CI must reproduce the same build. Without the pragma, the launcher follows the current default branch and warns that the result is not pinned.
External definitions may be launched from nested directories and may use a cached library checkout. Resolve project files from parameters.directories.projectDirectory; do not derive them from the location of SaneCppLibraries.
Cannot find SC-build.cpp: run inside the project tree or pass --project-dir.sc-build-version, network access, or use --libraries-root with a known checkout.Once the first target builds, continue with the SC::Build guide to add configurations, generated projects, or cross targets.