From bb0be73114f46ea7c273f12c5317bb30818a424d Mon Sep 17 00:00:00 2001 From: Daniel Trugman Date: Tue, 9 Apr 2024 14:03:35 +0100 Subject: [PATCH] Update find_package README section --- README.md | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index b4b7df3..a20fbfd 100644 --- a/README.md +++ b/README.md @@ -40,16 +40,34 @@ That's it, you are good to go. ### Use CMake's [`find_package()`](https://cmake.org/cmake/help/latest/command/find_package.html) +#### Option #1: `make install` (Preferred way) + After building the project, you can install it locally using `make install`. In your project's CMake file, you can then add the following snippet, and CMake will handle the rest: ``` -find_package(pfs) -include_directories (${pfs_INCLUDE_DIRS}) +find_package (pfs REQUIRED) +... +# Somewhere along the file you define your target +add_ ( ...) ... target_link_libraries ( pfs) ``` -CMake generates an `install_manifest.txt` file to track all the created files, this will help you uninstall the library if you need to do so. +NOTE: CMake generates an `install_manifest.txt` file to track all the created files, this will help you uninstall the library if you need to do so. + +#### Option #2: Without `make install` + +Build the `pfs` project. No need to call `make install`. +In your project's CMake file, you can then add the following snippet: +``` +find_package (pfs REQUIRED) +... +# Somewhere along the file you define your target +add_ ( ...) +... +target_link_libraries ( -L${pfs_LIBRARY_DIR} ${pfs_LIBRARIES}) +target_include_directories ( [PUBLIC|PRIVATE] ${pfs_INCLUDE_DIRS}) +``` ## Features