visual studio solution generated corrupted due to white space in visual studio path
I tried to make a small cmake project for a static library. On linux system, the makefile generated works as expected. However on windows 10 with visual studio 2017, generation of the solution seems to work :
cmake ..
-- Building for: Visual Studio 15 2017
-- Selecting Windows SDK version 10.0.17763.0 to target Windows 10.0.18363.
-- The C compiler identification is MSVC 19.16.27038.0
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.16.27023/bin/Hostx86/x86/cl.exe
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.16.27023/bin/Hostx86/x86/cl.exe - works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Configuring done
-- Generating done
-- Build files have been written to: D:/removed_path_but_no_spaces_in_it/cmake_build`
But when I try a cmake --build (or I have the same problem with the msbuild command), this is what happens:
PrepareForBuild:
Création du répertoire "fastinterp.dir\Debug\fastinterp.tlog\".
InitializeBuildStatus:
Création de "fastinterp.dir\Debug\fastinterp.tlog\unsuccessfulbuild", car "AlwaysCreate" a été spécifié.
CustomBuild:
Building Custom Rule D:/removed_path_but_no_spaces_in_it/CMakeLists.txt
ClCompile:
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\bin\HostX86\x86\CL.exe /c /Zi /nologo /W1 /WX- /diagnostics:classic /Od /Ob0 /Oy- /D "CMAKE_INTDIR=\"Debug\"" /D fastinterp_EXPORTS /D _WINDLL /D_MBCS /Gm- /RTC1 /MDd /GS /Zc:wchar_t /Zc:forScope /Zc:inline /Fo"fastinterp.dir\Debug\\" /Fd"fastinterp.dir\Debug\vc141.pdb" /Gd /TC /analyze- /errorReport:queue C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.16.27023/bin/Hostx86/x86/cl.exe "D:\removed_path_but_no_spaces_in_it\fast_interp\fast_interp.c"
Program
c1 : fatal error C1083: Impossible d'ouvrir le fichier source : 'C:/Program' : No such file or directory [D:\removed_path_but_no_spaces_in_it\cmake_build\fastinterp.vcxproj]
Files
c1 : fatal error C1083: Impossible d'ouvrir le fichier source : 'Files' : No such file or directory [D:\removed_path_but_no_spaces_in_it\cmake_build\fastinterp.vcxproj]
Microsoft
c1 : fatal error C1083: Impossible d'ouvrir le fichier source : '(x86)/Microsoft' : No such file or directory [D:\removed_path_but_no_spaces_in_it\cmake_build\fastinterp.vcxproj]
Visual
c1 : fatal error C1083: Impossible d'ouvrir le fichier source : 'Visual' : No such file or directory [D:\removed_path_but_no_spaces_in_it\cmake_build\fastinterp.vcxproj]
cl.exe
c1 : fatal error C1083: Impossible d'ouvrir le fichier source : 'Studio/2017/Community/VC/Tools/MSVC/14.16.27023/bin/Hostx86/x86/cl.exe' : No such file or directory [D:\removed_path_but_no_spaces_in_it\fast-cubic-spline-python\cmake_build\fastinterp.vcxproj]
I think the problemetic line is this one in the .vcxproj project generated but I might be wrong :
<ClCompile>
<AdditionalOptions>%(AdditionalOptions) C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.16.27023/bin/Hostx86/x86/cl.exe</AdditionalOptions>
...
G.F.
Edit : sorry some french words remained so 'Impossible d'ouvrir le fichier source' means 'unable to open source file'