cmake fails when bison executable path contains spaces
When I run cmake on a project that uses bison and has spaces, the generations fails with the error:
CMake Error at C:/Program Files/CMake/share/cmake-3.8/Modules/FindBISON.cmake:102 (message):
Command "C:/code/Free RCT/Libraries/win_bison/bison.bat --version" failed
with output:
'C:\code\Free' is not recognized as an internal or external command,
I'm building the FreeRCT project on Windows, using cmake version 3.8.1
Full output:
C:\code\Free RCT\FreeRCT\build>"C:\Program Files\CMake\bin\cmake.exe" -G "Visual Studio 14 2015" -DCMAKE_INSTALL_PREFIX:PATH="/Users/carlwa/Documents/CMakeInstalls" -DCMAKE_INSTALL_PREFIX="/Users/carlwa/Documents/CMakeInstalls" -DZLIB_LIBRARY="C:/code/Free RCT/FreeRCT/../Libraries/OpenTTD_essentials/win32/library/zlibstat.lib" -DZLIB_INCLUDE_DIR="C:/code/Free RCT/FreeRCT/../Libraries/OpenTTD_essentials/shared/include/" -DPNG_LIBRARY="C:/code/Free RCT/FreeRCT/../Libraries/OpenTTD_essentials/win32/library/libpng.lib" -DPNG_PNG_INCLUDE_DIR="C:/code/Free RCT/FreeRCT/../Libraries/OpenTTD_essentials/shared/include/" -DSDL2_LIBRARY="C:/code/Free RCT/FreeRCT/../libraries/SDL2/lib/x86/SDL2.lib" -DSDL2_INCLUDE_DIR="C:/code/Free RCT/FreeRCT/../libraries/SDL2/include" -DSDL2TTF_LIBRARY="C:/code/Free RCT/FreeRCT/../libraries/SDL2_ttf/lib/x86/SDL2_ttf.lib" -DSDL2TTF_INCLUDE_DIR="C:/code/Free RCT/FreeRCT/../libraries/SDL2_ttf/include" -DBISON_EXECUTABLE="C:/code/Free RCT/FreeRCT/../Libraries/win_bison/bison.bat" -DFLEX_EXECUTABLE="C:/code/Free RCT/FreeRCT/../Libraries/win_bison/flex.bat" -DCMAKE_CONFIGURATION_TYPES="Debug" "C:\code\Free RCT\FreeRCT"
-- The C compiler identification is MSVC 19.0.24215.1
-- The CXX compiler identification is MSVC 19.0.24215.1
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/cl.exe
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/cl.exe -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/cl.exe
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/cl.exe -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
--
-- Building rcdgen
-- Found ZLIB: C:/code/Free RCT/FreeRCT/../Libraries/OpenTTD_essentials/win32/library/zlibstat.lib (found version "1.2.7")
-- Found PNG: C:/code/Free RCT/FreeRCT/../Libraries/OpenTTD_essentials/win32/library/libpng.lib (found version "1.5.14")
CMake Error at C:/Program Files/CMake/share/cmake-3.8/Modules/FindBISON.cmake:102 (message):
Command "C:/code/Free RCT/Libraries/win_bison/bison.bat --version" failed
with output:
'C:\code\Free' is not recognized as an internal or external command,
operable program or batch file.
Call Stack (most recent call first):
src/rcdgen/CMakeLists.txt:50 (find_package)
-- Found BISON: C:/code/Free RCT/Libraries/win_bison/bison.bat
-- No bison executable found, using pregenerated parser
Command "C:/code/Free RCT/Libraries/win_bison/flex.bat --version" failed with output:
'C:\code\Free' is not recognized as an internal or external command,
operable program or batch file.
FLEX_VERSION will not be available
-- Found FLEX: C:/code/Free RCT/Libraries/win_bison/flex.bat
-- Building RCD Files
-- Building FreeRCT
-- Looking for pthread.h
-- Looking for pthread.h - not found
-- Found Threads: TRUE
-- Found SDL2: C:/code/Free RCT/FreeRCT/../libraries/SDL2/lib/x86/SDL2.lib
-- Found SDL2_ttf: C:/code/Free RCT/FreeRCT/../libraries/SDL2_ttf/lib/x86/SDL2_ttf.lib
-- Could NOT find Git (missing: GIT_EXECUTABLE)
CMake Error at src/CMakeLists.txt:208 (message):
No VCS checkout detected. Enable the OVERRIDE_VCS option if this is
intended. This is not recommended.
-- Configuring incomplete, errors occurred!
See also "C:/code/Free RCT/FreeRCT/build/CMakeFiles/CMakeOutput.log".
See also "C:/code/Free RCT/FreeRCT/build/CMakeFiles/CMakeError.log".