From c881ca8502362ea2d971693bea74d982009baebc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manuel=20P=C3=A9gouri=C3=A9-Gonnard?= Date: Tue, 1 Sep 2015 10:08:28 +0200 Subject: [PATCH] Document how to build shared libs with CMake Also updated https://tls.mbed.org/kb/compiling-and-building/how-do-i-build-compile-mbedtls closes #267 --- README.rst | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/README.rst b/README.rst index 8f5cac774b..db39512d95 100644 --- a/README.rst +++ b/README.rst @@ -89,13 +89,24 @@ CMake In order to build the source using CMake, just enter at the command line:: cmake . - make +In order to run the tests, enter:: + + make test + The test suites need Perl to be built. If you don't have Perl installed, you'll want to disable the test suites with:: cmake -DENABLE_TESTING=Off . +If you disabled the test suites, but kept the programs enabled, you can still run a much smaller set of tests with:: + + programs/test/selftest + +To configure CMake for building a shared library, use:: + + cmake -DUSE_SHARED_MBEDTLS_LIBRARY=On . + There are many different build modes available within the CMake buildsystem. Most of them are available for gcc and clang, though some are compiler-specific: - Release. @@ -121,23 +132,19 @@ There are many different build modes available within the CMake buildsystem. Mos This activates the compiler warnings that depend on optimization and treats all warnings as errors. -Switching build modes in CMake is simple. For debug mode, enter at the command line: +Switching build modes in CMake is simple. For debug mode, enter at the command line:: - cmake -D CMAKE_BUILD_TYPE:String="Debug" . + cmake -D CMAKE_BUILD_TYPE=Debug . + +To list other available CMake options, use:: + + cmake -LH Note that, with CMake, if you want to change the compiler or its options after you already ran CMake, you need to clear its cache first, eg (using GNU find):: find . -iname '*cmake*' -not -name CMakeLists.txt -exec rm -rf {} + CC=gcc CFLAGS='-fstack-protector-strong -Wa,--noexecstack' cmake . -In order to run the tests, enter:: - - make test - -If you disabled the test suites, but kept the progams enabled, you can still run a much smaller set of tests with:: - - programs/test/selftest - Microsoft Visual Studio -----------------------