# PackageProject.cmake **Repository Path**: lyric/package-project.cmake ## Basic Information - **Project Name**: PackageProject.cmake - **Description**: No description available - **Primary Language**: Unknown - **License**: MIT - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2021-05-30 - **Last Updated**: 2021-05-30 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README ![Test](https://github.com/TheLartians/PackageProject.cmake/workflows/Test/badge.svg) # PackageProject.cmake Creating installable CMake scripts always requires a large amount of boilerplate code to get things working. This small script should simplify the CMake packaging process into a single, easy-to-use command. ## Usage To create an installable target for your current project, add the following to your CMakeLists.txt. This example assumes the project to be versioned and the name to be identical to the library to export. Also the [CPM.cmake](https://github.com/TheLartians/CPM.cmake) script should be included. See [here](https://github.com/TheLartians/ModernCppStarter/blob/master/CMakeLists.txt) for an example usage. ```cmake CPMAddPackage("gh:TheLartians/PackageProject.cmake@1.6.0") packageProject( # the name of the target to export NAME ${PROJECT_NAME} # the version of the target to export VERSION ${PROJECT_VERSION} # a temporary directory to create the config files BINARY_DIR ${PROJECT_BINARY_DIR} # location of the target's public headers INCLUDE_DIR ${PROJECT_SOURCE_DIR}/include # should match the target's INSTALL_INTERFACE include directory INCLUDE_DESTINATION include/${PROJECT_NAME}-${PROJECT_VERSION} # semicolon separated list of the project's dependencies DEPENDENCIES "fmt 7.1.3;cxxopts 2.2.0" # (optional) create a header containing the version info # Note: that the path to headers should be lowercase VERSION_HEADER "${PROJECT_NAME}/version.h" # (optional) create a export header using GenerateExportHeader module EXPORT_HEADER "${PROJECT_NAME}/export.h" # (optional) install your library with a namespace (Note: do NOT add extra '::') NAMESPACE ${PROJECT_NAMESPACE} # (optional) define the project's version compatibility, defaults to `AnyNewerVersion` # supported values: `AnyNewerVersion|SameMajorVersion|SameMinorVersion|ExactVersion` COMPATIBILITY AnyNewerVersion # (optional) option to disable the versioning of install destinations DISABLE_VERSION_SUFFIX YES # (optional) option to ignore target architecture for package resolution # defaults to YES for header only (i.e. INTERFACE) libraries ARCH_INDEPENDENT YES ) ``` If you need extra functionality feel free to open an issue or a PR.