|
| 1 | +# wolfSSL Espressif Example Project CMakeLists.txt |
| 2 | +# v1.0 |
| 3 | +# |
1 | 4 | # The following lines of boilerplate have to be in your project's |
2 | 5 | # CMakeLists in this exact order for cmake to work correctly |
3 | | -cmake_minimum_required(VERSION 3.5) |
| 6 | +cmake_minimum_required(VERSION 3.16) |
4 | 7 |
|
| 8 | +# The wolfSSL CMake file should be able to find the source code. |
| 9 | +# Otherwise, assign an environment variable or set it here: |
| 10 | +# |
5 | 11 | # set(WOLFSSL_ROOT "~/workspace/wolfssl-other-source") |
6 | | - |
7 | | -# This tag is used to include this file in the ESP Component Registry: |
8 | | -# __ESP_COMPONENT_SOURCE__ |
9 | | - |
| 12 | +# |
10 | 13 | # Optional WOLFSSL_CMAKE_SYSTEM_NAME detection to find |
11 | 14 | # USE_MY_PRIVATE_CONFIG path for my_private_config.h |
12 | 15 | # |
| 16 | +# Expected path varies: |
| 17 | +# |
| 18 | +# WSL: /mnt/c/workspace |
| 19 | +# Linux: ~/workspace |
| 20 | +# Windows: C:\workspace |
| 21 | +# |
13 | 22 | if(WIN32) |
14 | 23 | # Windows-specific configuration here |
15 | 24 | set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWOLFSSL_CMAKE_SYSTEM_NAME_WINDOWS") |
@@ -38,6 +47,27 @@ if(APPLE) |
38 | 47 | endif() |
39 | 48 | # End optional WOLFSSL_CMAKE_SYSTEM_NAME |
40 | 49 |
|
| 50 | +# Check that there are not conflicting wolfSSL components |
| 51 | +# The ESP Registry Component will be in ./managed_components/wolfssl__wolfssl |
| 52 | +# The local component wolfSSL directory will be in ./components/wolfssl |
| 53 | +if( EXISTS "${CMAKE_HOME_DIRECTORY}/managed_components/wolfssl__wolfssl" AND EXISTS "${CMAKE_HOME_DIRECTORY}/components/wolfssl" ) |
| 54 | + # These exclude statements don't seem to be honored by the $ENV{IDF_PATH}/tools/cmake/project.cmake' |
| 55 | + # add_subdirectory("${CMAKE_HOME_DIRECTORY}/managed_components/wolfssl__wolfssl" EXCLUDE_FROM_ALL) |
| 56 | + # add_subdirectory("${CMAKE_HOME_DIRECTORY}/managed_components/wolfssl__wolfssl/include" EXCLUDE_FROM_ALL) |
| 57 | + # So we'll error out and let the user decide how to proceed: |
| 58 | + message(WARNING "\nFound wolfSSL components in\n" |
| 59 | + "./managed_components/wolfssl__wolfssl\n" |
| 60 | + "and\n" |
| 61 | + "./components/wolfssl\n" |
| 62 | + "in project directory: \n" |
| 63 | + "${CMAKE_HOME_DIRECTORY}") |
| 64 | + message(FATAL_ERROR "\nPlease use either the ESP Registry Managed Component or the wolfSSL component directory but not both.\n" |
| 65 | + "If removing the ./managed_components/wolfssl__wolfssl directory, remember to also remove " |
| 66 | + "or rename the idf_component.yml file typically found in ./main/") |
| 67 | +else() |
| 68 | + message(STATUS "No conflicting wolfSSL components found.") |
| 69 | +endif() |
| 70 | + |
41 | 71 | include($ENV{IDF_PATH}/tools/cmake/project.cmake) |
42 | 72 |
|
43 | 73 | project(wolfssl_template) |
0 commit comments