Skip to content

Commit 74a4984

Browse files
README.md: Fix/Improve CMake section
Signed-off-by: Ronald Cron <[email protected]>
1 parent c9998d3 commit 74a4984

File tree

1 file changed

+16
-14
lines changed

1 file changed

+16
-14
lines changed

README.md

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -95,14 +95,10 @@ In order to run the tests, enter:
9595
9696
ctest
9797
98-
The test suites need Python to be built and Perl to be executed. If you don't have one of these installed, you'll want to disable the test suites with:
98+
The test suites need Python to be built. If you don't have Python installed, you'll want to disable the test suites with:
9999
100100
cmake -DENABLE_TESTING=Off /path/to/mbedtls_source
101101
102-
If you disabled the test suites, but kept the programs enabled, you can still run a much smaller set of tests with:
103-
104-
programs/test/selftest
105-
106102
To configure CMake for building shared libraries, use:
107103
108104
cmake -DUSE_SHARED_MBEDTLS_LIBRARY=On /path/to/mbedtls_source
@@ -137,7 +133,7 @@ for example:
137133
CC=your_cc cmake /path/to/mbedtls_source
138134
139135
If you already invoked cmake and want to change those settings, you need to
140-
remove the build directory and create it again.
136+
invoke the configuration phase of CMake again with the new settings.
141137
142138
Note that it is possible to build in-place; this will however overwrite the
143139
legacy Makefiles still used for testing purposes (see
@@ -164,17 +160,23 @@ on the build mode as seen above), it's merely prepended to it.
164160
165161
#### Consuming Mbed TLS
166162
167-
Mbed TLS provides a package config file for consumption as a dependency in other
168-
CMake projects. You can include Mbed TLS's CMake targets yourself with:
163+
Mbed TLS provides a CMake package configuration file for consumption as a
164+
dependency in other CMake projects. You can load its CMake targets with:
165+
166+
find_package(MbedTLS REQUIRED)
167+
168+
You can help CMake find the package:
169169
170-
find_package(MbedTLS)
170+
- By setting the variable `MbedTLS_DIR` to `${YOUR_MBEDTLS_BUILD_DIR}/cmake`,
171+
as shown in `programs/test/cmake_package/CMakeLists.txt`, or
172+
- By adding the Mbed TLS installation prefix to `CMAKE_PREFIX_PATH`,
173+
as shown in `programs/test/cmake_package_install/CMakeLists.txt`.
171174
172-
If prompted, set `MbedTLS_DIR` to `${YOUR_MBEDTLS_INSTALL_DIR}/cmake`. This
173-
creates the following targets:
175+
After a successful `find_package(MbedTLS)`, the following imported targets are available:
174176
175-
- `MbedTLS::tfpsacrypto` (Crypto library)
176-
- `MbedTLS::mbedtls` (TLS library)
177-
- `MbedTLS::mbedx509` (X509 library)
177+
- `MbedTLS::tfpsacrypto`, the crypto library
178+
- `MbedTLS::mbedtls`, the TLS library
179+
- `MbedTLS::mbedx509`, the X.509 library
178180
179181
You can then use these directly through `target_link_libraries()`:
180182

0 commit comments

Comments
 (0)