Skip to content

Add missing dependencies in library CMakeLists.txt #10176

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: development
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions ChangeLog.d/fix-dependency-on-generated-files.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Bugfix
* Fix potential CMake parallel build failure due to missing dependencies.
The `mbedcrypto` and `mbedtls` libraries were missing dependencies on
generated files.
29 changes: 25 additions & 4 deletions library/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,17 @@ if(GEN_FILES)
${CMAKE_CURRENT_SOURCE_DIR}/../framework/scripts/generate_ssl_debug_helpers.py
${tls_error_headers}
)
else()
link_to_source(error.c)
link_to_source(version_features.c)
link_to_source(ssl_debug_helpers_generated.c)

add_custom_target(${MBEDTLS_TARGET_PREFIX}mbedx509_generated_files_target
DEPENDS
${CMAKE_CURRENT_BINARY_DIR}/error.c
)

add_custom_target(${MBEDTLS_TARGET_PREFIX}mbedtls_generated_files_target
DEPENDS
${CMAKE_CURRENT_BINARY_DIR}/ssl_debug_helpers_generated.c
${CMAKE_CURRENT_BINARY_DIR}/version_features.c
)
endif()

if(CMAKE_COMPILER_IS_GNUCC)
Expand Down Expand Up @@ -164,6 +171,13 @@ if(USE_STATIC_MBEDTLS_LIBRARY)
target_compile_options(${mbedtls_static_target} PRIVATE ${LIBS_C_FLAGS})
set_target_properties(${mbedtls_static_target} PROPERTIES OUTPUT_NAME mbedtls)
target_link_libraries(${mbedtls_static_target} PUBLIC ${libs} ${mbedx509_static_target})

if(GEN_FILES)
add_dependencies(${mbedx509_static_target}
${MBEDTLS_TARGET_PREFIX}mbedx509_generated_files_target)
add_dependencies(${mbedtls_static_target}
${MBEDTLS_TARGET_PREFIX}mbedtls_generated_files_target)
endif()
endif(USE_STATIC_MBEDTLS_LIBRARY)

if(USE_SHARED_MBEDTLS_LIBRARY)
Expand All @@ -178,6 +192,13 @@ if(USE_SHARED_MBEDTLS_LIBRARY)
target_compile_options(${mbedtls_target} PRIVATE ${LIBS_C_FLAGS})
set_target_properties(${mbedtls_target} PROPERTIES VERSION 4.0.0 SOVERSION 21)
target_link_libraries(${mbedtls_target} PUBLIC ${libs} ${mbedx509_target})

if(GEN_FILES)
add_dependencies(${mbedx509_target}
${MBEDTLS_TARGET_PREFIX}mbedx509_generated_files_target)
add_dependencies(${mbedtls_target}
${MBEDTLS_TARGET_PREFIX}mbedtls_generated_files_target)
endif()
endif(USE_SHARED_MBEDTLS_LIBRARY)

foreach(target IN LISTS target_libraries)
Expand Down