eidheim / tiny-process-library

A small platform independent library making it simple to create and stop new processes in C++, as well as writing to stdin and reading from stdout and stderr of a new process
MIT License
338 stars 73 forks source link

Won't build with MSYS using Ninja generator #2

Closed rpavlik closed 8 years ago

rpavlik commented 8 years ago

The issue is here: https://github.com/eidheim/tiny-process-library/blob/master/CMakeLists.txt#L12

It errors out trying to build process_unix.cpp

The CMake variable MSYS must presumably only be set under the MSYS makefile generator, and not under the ninja generator when used in the MSYS environment. (I don't recall seeing it before, so I don't know how standard/common/reliable of a variable it is to use)

If you assume that the user must use MSYS2 and cannot use MinGW on its own, then you could generalize the check to if(WIN32) - this is probably the simplest, best solution at least in the short term.

eidheim commented 8 years ago

Thank you for noticing this. I am sadly not familiar with ninja, but MSYS_PROCESS_USE_SH cannot be defined unless you have a MSYS2-like system on Windows with the sh command.

By the way, the MSYS variable is empty when using ninja under MSYS2? Maybe there is a better way to identify a MSYS2 system?