cmake_package_install.c 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. /*
  2. * Simple program to test that Mbed TLS builds correctly as an installable CMake
  3. * package.
  4. *
  5. * Copyright The Mbed TLS Contributors
  6. * SPDX-License-Identifier: Apache-2.0
  7. *
  8. * Licensed under the Apache License, Version 2.0 (the "License"); you may
  9. * not use this file except in compliance with the License.
  10. * You may obtain a copy of the License at
  11. *
  12. * http://www.apache.org/licenses/LICENSE-2.0
  13. *
  14. * Unless required by applicable law or agreed to in writing, software
  15. * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
  16. * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  17. * See the License for the specific language governing permissions and
  18. * limitations under the License.
  19. */
  20. #include "mbedtls/build_info.h"
  21. #if defined(MBEDTLS_PLATFORM_C)
  22. #include "mbedtls/platform.h"
  23. #else
  24. #include <stdio.h>
  25. #include <stdlib.h>
  26. #define mbedtls_fprintf fprintf
  27. #define mbedtls_printf printf
  28. #define mbedtls_exit exit
  29. #define MBEDTLS_EXIT_SUCCESS EXIT_SUCCESS
  30. #define MBEDTLS_EXIT_FAILURE EXIT_FAILURE
  31. #endif /* MBEDTLS_PLATFORM_C */
  32. #include "mbedtls/version.h"
  33. /* The main reason to build this is for testing the CMake build, so the program
  34. * doesn't need to do very much. It calls a single library function to ensure
  35. * linkage works, but that is all. */
  36. int main()
  37. {
  38. /* This version string is 18 bytes long, as advised by version.h. */
  39. char version[18];
  40. mbedtls_version_get_string_full( version );
  41. mbedtls_printf( "Built against %s\n", version );
  42. return( 0 );
  43. }