templates/cmake_templates
library
Functions
-
cmakeModuleTarget(String lib, {bool isCpp = false, bool isAndroidCpp = false})
→ String
-
Returns the CMake target block for a secondary module library.
-
generateCMakeContent(String pluginName, List<String> moduleLibs, String nitroNativePath, {List<({bool isAndroidCpp, bool isNativeCpp, String lib, String module})>? moduleInfos, String? linkChecksum})
→ String
-
Generates the full content of a fresh
src/CMakeLists.txt.
-
implSourcesBlock(String target, String className, {required bool unguarded})
→ String
-
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.
-
nitroImplSrcVar(String target)
→ String
-
The CMake CACHE variable name a Windows/Linux caller sets (before
add_subdirectory("../src")) to override which impl file gets compiled
for target — see _implSourcesBlock and _linkDesktopCMake /
needsSeparateWindowsImpl / needsSeparateLinuxImpl in link_command.dart.
Keyed per-target (not one global name) so multi-spec plugins with several
C++ module libraries in one src/CMakeLists.txt can override each
independently.