aboutsummaryrefslogtreecommitdiff
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorDavid Horstmann <david.horstmann@arm.com>2023-02-15 14:44:25 +0000
committerDavid Horstmann <david.horstmann@arm.com>2023-07-05 14:12:13 +0100
commit0f1dd5721441640bf75a5f24c4141d3f33f71b8b (patch)
tree5855333f7764b4fe8df4196561d1b1afdcbae427 /CMakeLists.txt
parent969c145f34dd448772c81044e43a007f2b3bc4aa (diff)
downloadmbedtls-0f1dd5721441640bf75a5f24c4141d3f33f71b8b.zip
mbedtls-0f1dd5721441640bf75a5f24c4141d3f33f71b8b.tar.gz
mbedtls-0f1dd5721441640bf75a5f24c4141d3f33f71b8b.tar.bz2
Use emptiness-checks rather than DEFINED checks
For the MBEDTLS_CONFIG_FILE and MBEDTLS_USER_CONFIG_FILE variables, check that they are non-empty and defined. This means they can be unconditionally created in the cache, simplifying the CMakeLists.txt Signed-off-by: David Horstmann <david.horstmann@arm.com>
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt14
1 files changed, 5 insertions, 9 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 7e1439f..d2b64cd 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -118,13 +118,9 @@ if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
FORCE)
endif()
-# If set, make MBEDTLS_CONFIG_FILE and MBEDTLS_USER_CONFIG_FILE into PATHs
-if(DEFINED MBEDTLS_CONFIG_FILE)
- set(MBEDTLS_CONFIG_FILE "" CACHE PATH "Mbed TLS config file (overrides default).")
-endif()
-if(DEFINED MBEDTLS_USER_CONFIG_FILE)
- set(MBEDTLS_USER_CONFIG_FILE "" CACHE PATH "Mbed TLS user config file (appended to default).")
-endif()
+# Make MBEDTLS_CONFIG_FILE and MBEDTLS_USER_CONFIG_FILE into PATHs
+set(MBEDTLS_CONFIG_FILE "" CACHE FILEPATH "Mbed TLS config file (overrides default).")
+set(MBEDTLS_USER_CONFIG_FILE "" CACHE FILEPATH "Mbed TLS user config file (appended to default).")
# Create a symbolic link from ${base_name} in the binary directory
# to the corresponding path in the source directory.
@@ -307,13 +303,13 @@ if(ENABLE_TESTING OR ENABLE_PROGRAMS)
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/everest/include)
# Pass-through MBEDTLS_CONFIG_FILE and MBEDTLS_USER_CONFIG_FILE
- if(DEFINED MBEDTLS_CONFIG_FILE)
+ if(MBEDTLS_CONFIG_FILE)
target_compile_definitions(mbedtls_test
PUBLIC MBEDTLS_CONFIG_FILE="${MBEDTLS_CONFIG_FILE}")
target_compile_definitions(mbedtls_test_helpers
PUBLIC MBEDTLS_CONFIG_FILE="${MBEDTLS_CONFIG_FILE}")
endif()
- if(DEFINED MBEDTLS_USER_CONFIG_FILE)
+ if(MBEDTLS_USER_CONFIG_FILE)
target_compile_definitions(mbedtls_test
PUBLIC MBEDTLS_USER_CONFIG_FILE="${MBEDTLS_USER_CONFIG_FILE}")
target_compile_definitions(mbedtls_test_helpers