CMake: Use generated source files from parent
When building as a submodule of a parent project, like Mbed TLS, use the
parent projects generated source files (error.c, version.c,
version_features.c)
@@ -29,7 +29,6 @@ set(src_crypto
ecp_curves.c
entropy.c
entropy_poll.c
- error.c
gcm.c
havege.c
hkdf.c
@@ -65,10 +64,26 @@ set(src_crypto
sha512.c
threading.c
timing.c
+ xtea.c
+)
+
+# For files generated by the parent project (Mbed TLS) when building Mbed
+# Crypto as a submodule, ensure that the parent project instance is used.
+if(USE_CRYPTO_SUBMODULE)
+set(src_crypto
+ ${src_crypto}
+ ${CMAKE_SOURCE_DIR}/library/version.c
+ ${CMAKE_SOURCE_DIR}/library/version_features.c
+ ${CMAKE_SOURCE_DIR}/library/error.c
+)
+else()
+set(src_crypto
+ ${src_crypto}
version.c
version_features.c
- xtea.c
+ error.c
)
+endif()
set(src_x509
certs.c
