I'm trying to build a little cross-platform application using curses. To use curses cross-platform, I'm using the instructions from this answer. It's almost working, except that on Windows (when running
cmake -G "MinGW Makefiles" .. && cmake --build . from my build folder), I get a bunch of errors about PCONSOLE_SCREEN_BUFFER_INFOEX not being defined. To fix this error, pdcurses says to set INFOEX=N in the mingw32-make call. I can compile it fine using mingw32-make -f Makefile INFOEX=N, but I can't figure out how to pass INFOEX=N from CMakeLists.txt.
How to add command line options for mingw32-make from CMakeLists.txt?
699 Views Asked by ThatCoolCoder At
1
A quick search through the repository indicates that the value is only used to add the
HAVE_NO_INFOEXcompiler definition. To allow the user to pass a configuration when configuring your project, you should add a cache variable which allows to pass the value when configuring the project (cmake -D VARIABLE_NAME=VALUE -G "MinGW Makefiles" ..).Adjusting the
CMakeLists.txtfile presented in the linked answer it could be done like this:Note: If you want to avoid requiring the user to make this choice and possibly getting it wrong you could also use
try_compileto check, source includingwindows.hand usingCONSOLE_SCREEN_BUFFER_INFOEXwould compile or not for windows target system...