# Building s2n-tls s2n-tls can be built as follows:
Ubuntu ```bash # install build dependencies sudo apt update sudo apt install cmake # install a libcrypto sudo apt install libssl-dev # build s2n-tls cmake . -Bbuild \ -DCMAKE_BUILD_TYPE=Release \ -DCMAKE_INSTALL_PREFIX=./s2n-tls-install cmake --build build -j $(nproc) CTEST_PARALLEL_LEVEL=$(nproc) ctest --test-dir build cmake --install build ```
MacOS ```bash # install build dependencies brew install cmake # install a libcrypto brew install openssl@3 # build s2n-tls cmake . -Bbuild \ -DCMAKE_BUILD_TYPE=Release \ -DCMAKE_PREFIX_PATH=$(dirname $(dirname $(brew list openssl@3|grep libcrypto.dylib))) \ -DCMAKE_INSTALL_PREFIX=./s2n-tls-install cmake --build build -j $(sysctl -n hw.ncpu) CTEST_PARALLEL_LEVEL=$(sysctl -n hw.ncpu) ctest --test-dir build cmake --install build ```
AL2 ```bash # install build dependencies sudo yum groupinstall "Development Tools" sudo yum install cmake3 # install a libcrypto sudo yum install openssl-devel # build s2n-tls cmake3 . -Bbuild \ -DCMAKE_BUILD_TYPE=Release \ -DCMAKE_INSTALL_PREFIX=./s2n-tls-install \ -DCMAKE_EXE_LINKER_FLAGS="-lcrypto -lz" cmake3 --build build -j $(nproc) cd build CTEST_PARALLEL_LEVEL=$(nproc) ctest3 cd .. cmake3 --install build ```
Note that we currently do not support building on Windows. See https://github.com/aws/s2n-tls/issues/497 for more information. Using the commands above, the libraries and headers will be located in the `s2n-tls-install` directory. The s2nc and s2nd test utilities are not installed by default, but can be found in the `build/bin` directory. To also install s2nc and s2nd, add `-DS2N_INSTALL_S2NC_S2ND=1` to the cmake command. ## Consuming s2n-tls via CMake s2n-tls ships with modern CMake finder scripts if CMake is used for the build. To take advantage of this from your CMake script, all you need to do to compile and link against s2n-tls in your project is: ````bash find_package(s2n) .... target_link_libraries(yourExecutableOrLibrary AWS::s2n) ```` And when invoking CMake for your project, do one of two things: 1. Set the `CMAKE_INSTALL_PREFIX` variable with the path to your s2n-tls build. 2. If you have globally installed s2n-tls, do nothing, it will automatically be found. ## Configuring the s2n-tls build s2n-tls can be configured with the following CMake options. Each option can be set by passing a `-D