Merge pull request #4259 from CJKay/cmake-config

Add CMake package config file
This commit is contained in:
Dave Rodgman 2021-06-25 20:32:13 +01:00 committed by GitHub
commit 10bda58b49
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
14 changed files with 324 additions and 41 deletions

View file

@ -273,7 +273,7 @@ cleanup()
-iname CMakeFiles -exec rm -rf {} \+ -o \
\( -iname cmake_install.cmake -o \
-iname CTestTestfile.cmake -o \
-iname CMakeCache.txt \) -exec rm {} \+
-iname CMakeCache.txt \) -exec rm -f {} \+
# Recover files overwritten by in-tree CMake builds
rm -f include/Makefile include/mbedtls/Makefile programs/*/Makefile
git update-index --no-skip-worktree Makefile library/Makefile programs/Makefile tests/Makefile programs/fuzz/Makefile
@ -284,6 +284,16 @@ cleanup()
rm -f programs/test/cmake_subproject/Makefile
rm -f programs/test/cmake_subproject/cmake_subproject
# Remove any artifacts from the component_test_cmake_as_package test.
rm -rf programs/test/cmake_package/build
rm -f programs/test/cmake_package/Makefile
rm -f programs/test/cmake_package/cmake_package
# Remove any artifacts from the component_test_cmake_as_installed_package test.
rm -rf programs/test/cmake_package_install/build
rm -f programs/test/cmake_package_install/Makefile
rm -f programs/test/cmake_package_install/cmake_package_install
if [ -f "$CONFIG_BAK" ]; then
mv "$CONFIG_BAK" "$CONFIG_H"
fi
@ -2540,6 +2550,32 @@ component_test_cmake_as_subdirectory () {
unset MBEDTLS_ROOT_DIR
}
component_test_cmake_as_package () {
msg "build: cmake 'as-package' build"
MBEDTLS_ROOT_DIR="$PWD"
cd programs/test/cmake_package
cmake .
make
if_build_succeeded ./cmake_package
cd "$MBEDTLS_ROOT_DIR"
unset MBEDTLS_ROOT_DIR
}
component_test_cmake_as_package_install () {
msg "build: cmake 'as-installed-package' build"
MBEDTLS_ROOT_DIR="$PWD"
cd programs/test/cmake_package_install
cmake .
make
if_build_succeeded ./cmake_package_install
cd "$MBEDTLS_ROOT_DIR"
unset MBEDTLS_ROOT_DIR
}
component_test_zeroize () {
# Test that the function mbedtls_platform_zeroize() is not optimized away by
# different combinations of compilers and optimization flags by using an