cmakeToolchainFile method

String? cmakeToolchainFile(
  1. NativeTarget target
)

Resolve a CMake toolchain file for target, if applicable.

Returns null when no toolchain file is needed or discovery fails.

Implementation

String? cmakeToolchainFile(NativeTarget target) {
  if (target.os == OS.android) {
    final ndk = _findAndroidNdk();
    if (ndk == null) return null;
    final candidate = p.join(
      ndk.path,
      'build',
      'cmake',
      'android.toolchain.cmake',
    );
    if (File(candidate).existsSync()) return candidate;
    return null;
  }
  if (target.os == OS.iOS) {
    // Caller should set TOOLCHAIN_FILE to CMake/iOS.cmake relative to
    // source; we only signal that iOS expects a toolchain.
    return null;
  }
  return null;
}