I think writing a CMake script which downloads ninja an places it somewhere would be best. See how CMake does it for CI (in powershell, but CMake code is just less verbose). You can then do:
cmake_minimum_required(VERSION X.Y)
if (NOT EXISTS "${CMAKE_SOURCE_DIR}/.build-tools/ninja.exe")
execute_process(COMMAND "${CMAKE_COMMAND}" -P "${CMAKE_SOURCE_DIR}/.build-tools/get-ninja.cmake")
endif ()
if (NOT CMAKE_MAKE_COMMAND AND CMAKE_GENERATOR MATCHES "Ninja")
set(CMAKE_MAKE_COMMAND "${CMAKE_SOURCE_DIR}/.build-tools/ninja.exe" CACHE FILEPATH "")
endif ()
project(myproject)
Some error checking may be warranted.