<ClCompile> bug in MSVC needs workaround for <PrecompiledHeaderOutputFile> when path is in quotes (Normalize XML quotes in 3.9.0)
I just reported a bug to Microsoft about in the MSVC build scripts CMake is generating.
I don't know if I (as a user) am in any position to remedy this.
I believe CMake builds this script by parsing compiler options. If the paths have spaces (all paths may potentially) CMake slices many of the fields up in unpredictable ways. I don't think that's avoidable by parsing the options, so quotes are required...
The problem arises because in this one field (there are others including PrecompiledHeaderFile above it) if quotes are in the XML value, then MSVC generates error MSB4198. So MSVC is inconsistent. But CMake should be removing the quotes in this case anyway.
If there's anything I can do to fix my module please tell me. Below is a snippet from the vcxproj file.
<ClCompile>
<AdditionalIncludeDirectories>C:\Users\Michael\COLLADA-DOM (Official)\dom\include;C:\Users\Michael\COLLADA-DOM (Official)\dom\external-libs\libxml2\cmake;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AssemblerListingLocation>Debug/</AssemblerListingLocation>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<CompileAs>CompileAsCpp</CompileAs>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<ExceptionHandling>Sync</ExceptionHandling>
<ForcedIncludeFiles>"C:/Users/Michael/COLLADA-DOM (Official)/dom/include/ColladaDOM.inl"</ForcedIncludeFiles>
<InlineFunctionExpansion>Disabled</InlineFunctionExpansion>
<Optimization>Disabled</Optimization>
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>"C:/Users/Michael/COLLADA-DOM (Official)/dom/include/ColladaDOM.inl"</PrecompiledHeaderFile>
<PrecompiledHeaderOutputFile>"C:/CMake/bin/colladadom25/dom/CMakeFiles/colladadom25.pch.dir/include/ColladaDOM.inl.pch"</PrecompiledHeaderOutputFile>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<RuntimeTypeInfo>true</RuntimeTypeInfo>
<WarningLevel>Level3</WarningLevel>
<PreprocessorDefinitions>WIN32;_WINDOWS;_DEBUG;_DEBUG;COLLADA_UPTR_MAX=0xffFFffFF;COLLADA_DOM_UNORDERED_MAP;COLLADA_DOM_WARNING_HPP;EXPORTING_COLLADA_DOM;BUILDING_IN_LIBXML;CMAKE_INTDIR="Debug";colladadom25_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ObjectFileName>$(IntDir)</ObjectFileName>
</ClCompile>
If I remove the quotes from by hand the following error goes away.
C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Microsoft.CppBuild.targets(873,21): error MSB4198: The expression "DirectoryName" cannot be evaluated on item ""C:/CMake/bin/colladadom25/dom/CMakeFiles/colladadom25.pch.dir/include/ColladaDOM.inl.pch"". Illegal characters in path.
(There are likely many fields that should not be quoted, if the goal is to identify them all, but Microsoft's product only halts on this one that I know of. EDITED: Actually <ProgramDataBaseFileName>
halts also...)