MinGW: resource compilation fails with space in path to windres
When trying to build ZLIB with cmake and MinGW (64 bit), the cmake build will fail when building windows resources. The problem is that the path to windres.exe is set up with a path including a space as c:\program files\mingw....\windres.exe
. Checking with the cmake-gui application the CMAKE_RC_COMPILER
has the previous value while the CMAKE_MAKE_PROGRAM
has the C:/PROGRA~1/MINGW-~1/X86_64~1.0-P/mingw64/bin/mingw32-make.exe
.
The workaround is to install MinGW in a directory without spaces. Error when building through cmake --build ...
L:\>cmake --build "o:\build\zlib\gcc\Debug" --config Debug
[ 2%] Generating zlib1rc.obj
'C:\Program' is not recognized as an internal or external command,
operable program or batch file.
C:\Program Files\mingw-w64\x86_64-8.1.0-posix-seh-rt_v6-rev0\mingw64\bin\windres.exe: preprocessing failed.
mingw32-make.exe[2]: *** [CMakeFiles\zlib.dir\build.make:73: zlib1rc.obj] Error 1
mingw32-make.exe[1]: *** [CMakeFiles\Makefile2:91: CMakeFiles/zlib.dir/all] Error 2
mingw32-make.exe: *** [Makefile:145: all] Error 2
Edited by Brad King