pw_build/cmake: Add pw_target_link_targets helper

Adds a helper function to wrap target_link_libraries which is
stricter in the sense that only CMake targets are supported and
at the end of configuration it is confirmed that they all exist.

This helps mitigate the risk of typos in dependencies and prohibits
direct library names, library files, link flags, and generator
expressions which are ordinarily supported by target_link_libraries.

This also updates most of the Pigweed CMake functions to use the
new helper instead of target_link_libraries, except for pw_add_test
as one of the callers still uses generator expressions.

Change-Id: Ia589cf826ac4604c9e11f1d5cde1eff2dc3e4d66
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/109952
Commit-Queue: Auto-Submit <auto-submit@pigweed.google.com.iam.gserviceaccount.com>
Reviewed-by: Wyatt Hepler <hepler@google.com>
Pigweed-Auto-Submit: Ewout van Bekkum <ewout@google.com>
2 files changed
tree: 9576236f6627d97501cec08979f7ee9aff6a45dd
  1. .allstar/
  2. build_overrides/
  3. docker/
  4. docs/
  5. pw_allocator/
  6. pw_analog/
  7. pw_android_toolchain/
  8. pw_arduino_build/
  9. pw_assert/
  10. pw_assert_basic/
  11. pw_assert_log/
  12. pw_assert_tokenized/
  13. pw_assert_zephyr/
  14. pw_base64/
  15. pw_bloat/
  16. pw_blob_store/
  17. pw_bluetooth/
  18. pw_bluetooth_hci/
  19. pw_boot/
  20. pw_boot_cortex_m/
  21. pw_build/
  22. pw_build_info/
  23. pw_build_mcuxpresso/
  24. pw_bytes/
  25. pw_checksum/
  26. pw_chrono/
  27. pw_chrono_embos/
  28. pw_chrono_freertos/
  29. pw_chrono_stl/
  30. pw_chrono_threadx/
  31. pw_chrono_zephyr/
  32. pw_cli/
  33. pw_compilation_testing/
  34. pw_console/
  35. pw_containers/
  36. pw_cpu_exception/
  37. pw_cpu_exception_cortex_m/
  38. pw_crypto/
  39. pw_digital_io/
  40. pw_docgen/
  41. pw_doctor/
  42. pw_env_setup/
  43. pw_file/
  44. pw_function/
  45. pw_fuzzer/
  46. pw_hdlc/
  47. pw_hex_dump/
  48. pw_i2c/
  49. pw_i2c_mcuxpresso/
  50. pw_interrupt/
  51. pw_interrupt_cortex_m/
  52. pw_interrupt_zephyr/
  53. pw_kvs/
  54. pw_libc/
  55. pw_log/
  56. pw_log_android/
  57. pw_log_basic/
  58. pw_log_null/
  59. pw_log_rpc/
  60. pw_log_string/
  61. pw_log_tokenized/
  62. pw_log_zephyr/
  63. pw_malloc/
  64. pw_malloc_freelist/
  65. pw_metric/
  66. pw_minimal_cpp_stdlib/
  67. pw_module/
  68. pw_multisink/
  69. pw_package/
  70. pw_persistent_ram/
  71. pw_polyfill/
  72. pw_preprocessor/
  73. pw_presubmit/
  74. pw_protobuf/
  75. pw_protobuf_compiler/
  76. pw_random/
  77. pw_result/
  78. pw_ring_buffer/
  79. pw_router/
  80. pw_rpc/
  81. pw_rust/
  82. pw_snapshot/
  83. pw_software_update/
  84. pw_span/
  85. pw_spi/
  86. pw_status/
  87. pw_stm32cube_build/
  88. pw_stream/
  89. pw_string/
  90. pw_symbolizer/
  91. pw_sync/
  92. pw_sync_baremetal/
  93. pw_sync_embos/
  94. pw_sync_freertos/
  95. pw_sync_stl/
  96. pw_sync_threadx/
  97. pw_sync_zephyr/
  98. pw_sys_io/
  99. pw_sys_io_arduino/
  100. pw_sys_io_baremetal_lm3s6965evb/
  101. pw_sys_io_baremetal_stm32f429/
  102. pw_sys_io_emcraft_sf2/
  103. pw_sys_io_mcuxpresso/
  104. pw_sys_io_stdio/
  105. pw_sys_io_stm32cube/
  106. pw_sys_io_zephyr/
  107. pw_system/
  108. pw_target_runner/
  109. pw_thread/
  110. pw_thread_embos/
  111. pw_thread_freertos/
  112. pw_thread_stl/
  113. pw_thread_threadx/
  114. pw_tls_client/
  115. pw_tls_client_boringssl/
  116. pw_tls_client_mbedtls/
  117. pw_tokenizer/
  118. pw_tool/
  119. pw_toolchain/
  120. pw_trace/
  121. pw_trace_tokenized/
  122. pw_transfer/
  123. pw_unit_test/
  124. pw_varint/
  125. pw_watch/
  126. pw_web/
  127. pw_work_queue/
  128. targets/
  129. third_party/
  130. ts/
  131. zephyr/
  132. .bazelignore
  133. .bazelrc
  134. .clang-format
  135. .clang-tidy
  136. .eslintrc.json
  137. .gitattributes
  138. .gitignore
  139. .gn
  140. .prettierrc.js
  141. .pylintrc
  142. activate.bat
  143. Android.bp
  144. AUTHORS
  145. bootstrap.bat
  146. bootstrap.sh
  147. BUILD.bazel
  148. BUILD.gn
  149. BUILDCONFIG.gn
  150. CMakeLists.txt
  151. jest.config.ts
  152. Kconfig.zephyr
  153. LICENSE
  154. modules.gni
  155. OWNERS
  156. package-lock.json
  157. package.json
  158. PIGWEED_MODULES
  159. PW_PLUGINS
  160. README.md
  161. rollup.config.js
  162. tsconfig.json
  163. WORKSPACE
README.md

Pigweed

Pigweed is an open source collection of embedded-targeted libraries–or as we like to call them, modules. These modules are building blocks and infrastructure that enable faster and more reliable development on small-footprint MMU-less 32-bit microcontrollers like the STMicroelectronics STM32L452 or the Nordic nRF52832.

For more information please see our website: https://pigweed.dev/.

Links