CMake does not generate files starting with `./`
Consider a following CMake file:
cmake_minimum_required(VERSION 3.5)
project(foo C)
set(out_file "./zzz.txt")
add_custom_command(
OUTPUT ${out_file}
COMMAND cmake -E touch ${out_file}
)
add_custom_command(
OUTPUT "bar.txt"
COMMAND cmake -E touch "bar.txt"
DEPENDS ${out_file}
)
add_custom_target(do_blah DEPENDS "bar.txt")
Trying to run do_blah
command would fail with an error zzz.txt is missing an no known rule to make it
.
Looking at ninja/makefile would reveal that the rule for zzz.txt
generation is not even created!
Simply renaming out_file
to any of zzz.txt|.zzz.txt|gen/zzz.txt
fixes the issue.