Skip to content

Commit

Permalink
Update README with additional CMake setup information
Browse files Browse the repository at this point in the history
  • Loading branch information
Technius committed Dec 14, 2023
1 parent f9479dd commit b8730c8
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,35 @@ To copy the header files into `/usr/local/include/sparta` and set up a cmake lib
sudo make install
```

### CMake Setup

If you are using CMake for your project, you can also use SPARTA in the following ways:

* A system-wide installation of SPARTA will contain a CMake configuration file that exports the library as `sparta::sparta`. This enables the use of `find_package` to locate SPARTA. For example:

```cmake
find_package(Boost REQUIRED COMPONENTS thread) # required by SPARTA
find_package(sparta REQUIRED)
add_library(MyAnalysisLibrary)
target_link_libraries(MyAnalysisLibrary PUBLIC sparta::sparta)
```

* If you have cloned and "built" SPARTA locally, you can use a `find_package` call (such as the one above) and run CMake with the `-Dsparta_DIR=<your_sparta_build_dir>` to load the library:

```sh
# Assuming you are at the top-level of your project that uses SPARTA
mkdir build && cd build
cmake .. -Dsparta_DIR=path/to/your/sparta/build
```

* SPARTA can be added as a subdirectory in your project:

```cmake
# assuming you have cloned SPARTA into a folder named sparta
add_subdirectory(sparta)
add_library(MyAnalysisLibrary)
target_link_libraries(MyAnalysisLibrary PUBLIC sparta::sparta)
```

## Issues

Expand Down

0 comments on commit b8730c8

Please sign in to comment.