Skip to content

Easy botan integration into cmake projects using automatically generated amalgamation files.

License

Notifications You must be signed in to change notification settings

Tectu/botan-cmake

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

37 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Overview

This repository provides FindBotan.cmake which allows for easy inclusion of Botan into CMake based projects.

Unlike other CMake integrations for Botan, this one does not simply add all the Botan files to a target. Instead, it does the following automagically:

  1. Download the requested version of Botan (if not provided locally).
  2. Run Botan's python script to generate the amalgamation files botan_all.h and botan_all.cpp.
  3. Provide a CMake target to compile & link those amalgamation files.

Refer to Botan's The Amalgamation Build documentation for more information on the amalgamation build.

Licensing

Code provided by this repository is considered to be public domain using the Unlicense license. However, note that Botan ships with its own licensing.

Usage

To use this Botan CMake integration:

  1. Download/copy cmake/FindBotan.cmake from this repository to your local CMake project.
  2. Add that CMake script to your CMake module path (CMAKE_MODULE_PATH).
  3. Use find_package() to "include" that CMake script in your project. Do not specify any components.
  4. Use the botan_generate() function to generate a target with specific Botan modules enabled.
  5. Use target_link_libraries() to link to the generated CMake target.
  6. Include botan_all.h where needed.

An example project is provided under /example.

Your CMakeLists.txt:

# Find Botan
find_package(
    botan 3.4.0
    REQUIRED
)

# Create target "my_botan_target" with modules "system_rng" and "sha3" enabled
# Any Botan module can be listed here
botan_generate(
    my_botan_target
        system_rng
        sha3
)

# Link to generated target
target_link_libraries(
    MyTarget
    PRIVATE
        my_botan_target
)

Local Botan distribution

By default, this CMake module will download the Botan upstream distribution tarball. If this is undesired, a path to a local copy of the tarball can be supplied via the Botan_PATH variable.

About

Easy botan integration into cmake projects using automatically generated amalgamation files.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published