Added submodule contents into tree
This commit is contained in:
3
externals/mbedtls/programs/test/cmake_package_install/.gitignore
vendored
Normal file
3
externals/mbedtls/programs/test/cmake_package_install/.gitignore
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
build
|
||||
Makefile
|
||||
cmake_package_install
|
||||
41
externals/mbedtls/programs/test/cmake_package_install/CMakeLists.txt
vendored
Normal file
41
externals/mbedtls/programs/test/cmake_package_install/CMakeLists.txt
vendored
Normal file
@@ -0,0 +1,41 @@
|
||||
cmake_minimum_required(VERSION 3.5.1)
|
||||
|
||||
#
|
||||
# Simulate configuring and building Mbed TLS as the user might do it. We'll
|
||||
# install into a directory inside our own build directory.
|
||||
#
|
||||
|
||||
set(MbedTLS_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../../..")
|
||||
set(MbedTLS_INSTALL_DIR "${CMAKE_CURRENT_BINARY_DIR}/mbedtls")
|
||||
set(MbedTLS_BINARY_DIR "${MbedTLS_INSTALL_DIR}${CMAKE_FILES_DIRECTORY}")
|
||||
|
||||
execute_process(
|
||||
COMMAND "${CMAKE_COMMAND}"
|
||||
"-H${MbedTLS_SOURCE_DIR}"
|
||||
"-B${MbedTLS_BINARY_DIR}"
|
||||
"-DENABLE_PROGRAMS=NO"
|
||||
"-DENABLE_TESTING=NO"
|
||||
# Turn on generated files explicitly in case this is a release
|
||||
"-DGEN_FILES=ON"
|
||||
"-DCMAKE_INSTALL_PREFIX=${MbedTLS_INSTALL_DIR}")
|
||||
|
||||
execute_process(
|
||||
COMMAND "${CMAKE_COMMAND}"
|
||||
--build "${MbedTLS_BINARY_DIR}"
|
||||
--target install)
|
||||
|
||||
#
|
||||
# Locate the package.
|
||||
#
|
||||
|
||||
list(INSERT CMAKE_PREFIX_PATH 0 "${MbedTLS_INSTALL_DIR}")
|
||||
find_package(MbedTLS REQUIRED)
|
||||
|
||||
#
|
||||
# At this point, the Mbed TLS targets should have been imported, and we can now
|
||||
# link to them from our own program.
|
||||
#
|
||||
|
||||
add_executable(cmake_package_install cmake_package_install.c)
|
||||
target_link_libraries(cmake_package_install
|
||||
MbedTLS::mbedcrypto MbedTLS::mbedtls MbedTLS::mbedx509)
|
||||
28
externals/mbedtls/programs/test/cmake_package_install/cmake_package_install.c
vendored
Normal file
28
externals/mbedtls/programs/test/cmake_package_install/cmake_package_install.c
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
/*
|
||||
* Simple program to test that Mbed TLS builds correctly as an installable CMake
|
||||
* package.
|
||||
*
|
||||
* Copyright The Mbed TLS Contributors
|
||||
* SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
|
||||
*/
|
||||
|
||||
#include "mbedtls/build_info.h"
|
||||
|
||||
#include "mbedtls/platform.h"
|
||||
|
||||
#include "mbedtls/version.h"
|
||||
|
||||
/* The main reason to build this is for testing the CMake build, so the program
|
||||
* doesn't need to do very much. It calls a single library function to ensure
|
||||
* linkage works, but that is all. */
|
||||
int main()
|
||||
{
|
||||
/* This version string is 18 bytes long, as advised by version.h. */
|
||||
char version[18];
|
||||
|
||||
mbedtls_version_get_string_full(version);
|
||||
|
||||
mbedtls_printf("Built against %s\n", version);
|
||||
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user