OUTPUT_NAME incorrectly allows paths for some generators
cmake -GNinja fails on Windows if the CMakeLists.txt file contains
set_target_properties(<target> PROPERTIES OUTPUT_NAME <name>)
I've noticed two different versions of the error:
- Error1: if the above command is in the root CMakeLists.txt, Ninja complains about multiple instructions to produce the same executable:
ninja: error: build.ninja:166: multiple rules generate D:/a/run-cmake-fails-on-windows-runner/run-cmake-fails-on-windows-runner/build/helloWorld1.exe [-w dupbuild=err]
- Error2: occurs if the command is in a subdirectory that has been added with add_subdirectory(). In this case, path prefix and added subdirectory are swapped, resulting in something like
ninja: error: FindFirstFileExA(src/d:/a/run-cmake-fails-on-windows-runner/run-cmake-fails-on-windows-runner/build): The filename, directory name, or volume label syntax is incorrect.
I've set up a minimal demonstration here: https://github.com/ugermann/run-cmake-fails-on-windows-runner
-DSHOW_ERROR1=on to trigger error 1,
-DSHOW_ERROR2=on to trigger error 2.