CMake Quick Start - TPM2 Reference Library
October 4, 2024 ยท View on GitHub
NOTE: ** CMake support is experimental and does not yet support Linux. **
These instructions are under development and subject to change.
Known Issues
- Does not search for packages (such as OpenSSL); OpenSSL must be installed as system (on Linux) or as described in Windows Build.
- Build failure with WOLF crypto libraries.
Prerequisites
Install CMake & put it on your path
This is performed in an OS specific way, possibilities include:
- using apt-get on Linux,
- Installing the MSI or Zip version of CMake directly from CMake.org
- Using the CMake tools from a Visual Studio Installation
Obtain the OpenSSL library
Follow the relevant Build Instructions for your OS.
Install Powershell 7 and put it on your path.
This is optional, but assumed by the cmake_* scripts because of occassional issued
with the tee command to capture and display logs simultaneously.
if you don't want this functionality you can edit the cmake_*.cmd scripts to call
powershell and ignore the resulting warnings, or remove tee entirely.
Build it
After configuring your environment, you can configure the Tpm Core Library, platform library, and simulator in a single CMake build system and build it.
Run scripts\cmake_onepass.cmd
Alternative Approach
- Install Visual Studio 2019 or 2022 and include the CMake recommended components.
- Open the TPMCmd folder in Visual Studio as a "Folder" (do NOT open the
TpmSimulator.slnsolution)
Visual Studio should detect the CMakeLists.txt file and load and configure the CMake environment automatically. You will still need to configure OpenSSL.