File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11# PackageProject.cmake
22
3- A small helper script to simplify the CMake packaging process.
3+ Creating installable CMake scripts always requires a large amount of boilerplate code to get things working.
4+ This small script should simplify the CMake packaging process into a single, easy-to-use command.
45
56## Usage
67
78To create an installable target for your current project, add the following to your CMakeLists.txt.
89This example assumes the project to be versioned and the name to be identical to the library to export.
9- Also the [ CPM.cmake] ( https://github.com/TheLartians/CPM.cmake ) should be included.
10+ Also the [ CPM.cmake] ( https://github.com/TheLartians/CPM.cmake ) script should be included.
11+ See [ here] ( https://github.com/TheLartians/ModernCppStarter/blob/master/CMakeLists.txt ) for an example usage.
1012
1113``` cmake
1214CPMAddPackage(
@@ -16,13 +18,17 @@ CPMAddPackage(
1618)
1719
1820packageProject(
21+ # the name of the target to export
1922 NAME ${PROJECT_NAME}
23+ # the version of the target to export
2024 VERSION ${PROJECT_VERSION}
25+ # a temporary directory to create the config files
2126 BINARY_DIR ${PROJECT_BINARY_DIR}
27+ # location of the target's public headers
2228 INCLUDE_DIR ${PROJECT_SOURCE_DIR}/include
29+ # should match the target's INSTALL_INTERFACE include directory
2330 INCLUDE_DESTINATION include/${PROJECT_NAME}-${PROJECT_VERSION}
2431)
2532```
2633
2734If you need extra functionality feel free to open an issue or a PR.
28-
You can’t perform that action at this time.
0 commit comments