diff --git a/ChangeLog.d/cmake_add_subdirectory_support.txt b/ChangeLog.d/cmake_add_subdirectory_support.txt new file mode 100644 index 000000000..afcc4b6c4 --- /dev/null +++ b/ChangeLog.d/cmake_add_subdirectory_support.txt @@ -0,0 +1,4 @@ +Changes + * Add aliases for libraries so that the normal MbedTLS::* targets + work when MbedTLS is built as a subdirectory. Allows use of + CMake's FetchContent, as requested in #5688. diff --git a/library/CMakeLists.txt b/library/CMakeLists.txt index 6bb2ad38c..c01dbc66f 100644 --- a/library/CMakeLists.txt +++ b/library/CMakeLists.txt @@ -279,6 +279,7 @@ if(USE_SHARED_MBEDTLS_LIBRARY) endif(USE_SHARED_MBEDTLS_LIBRARY) foreach(target IN LISTS target_libraries) + add_library(MbedTLS::${target} ALIAS ${target}) # add_subdirectory support # Include public header files from /include and other directories # declared by /3rdparty/**/CMakeLists.txt. Include private header files # from /library and others declared by /3rdparty/**/CMakeLists.txt.