implSourcesBlock function

String implSourcesBlock(
  1. String target,
  2. String className, {
  3. required bool unguarded,
})

Emits the target_sources call that adds the hand-maintained C++ impl file to target. Always prefers the caller-supplied nitroImplSrcVar CACHE variable when defined — this is how windows/CMakeLists.txt and linux/CMakeLists.txt (see _linkDesktopCMake in link_command.dart) point this shared src/CMakeLists.txt at their OWN platform-specific impl file instead of being forced to share one — falling back to the historical Hybrid$className.cpp name so plugins that never set it (the vast majority — anyone not targeting Windows-C++ AND Linux-C++ simultaneously) see byte-identical output to before this existed.

unguarded true for Android-C++ (compiled unconditionally); false wraps the call in if(NOT ANDROID) so Android/Kotlin builds skip it. Public form of the guarded impl-sources block, for nitrogen link to retrofit onto an EXISTING src/CMakeLists.txt that still hardcodes target_sources(<lib> PRIVATE "HybridXxx.cpp") (pre-separation layout): without the guard, the NITRO_IMPL_SRC_<lib> variables set by the platform CMakeLists are silently ignored (issue #12).

Implementation

String implSourcesBlock(String target, String className, {required bool unguarded}) => _implSourcesBlock(target, className, unguarded: unguarded);