VS: 3.21.0 removes cl compile option /FS
Compile option "/FS" should be added to <AdditionalOptions>
, not just <ForceSynchronousPDBWrites>
.
With CMake 3.21 (from v3.21.0-rc1), the XML (vcxproj) generation for add_compile_options( "/FS" )
has changed, compared to older CMake versions. This behavior change is probably introduced by commit 887e9df0 (June 4, 2021).
CMake 3.20.5 generated vcxproj files which just added /FS to the <AdditionalOptions>
:
<AdditionalOptions>%(AdditionalOptions) /FS</AdditionalOptions>
CMake 3.21 adds a <ForceSynchronousPDBWrites>
XML element instead, to the generated vcxproj files:
<ForceSynchronousPDBWrites>true</ForceSynchronousPDBWrites>
This <ForceSynchronousPDBWrites>
XML element does not trigger Visual Studio to pass "/FS" to the compiler ("cl"), at least not when using VS2019 Version 16.10.3 of 16.10.4. As a consequence, the "fatal compile errors" that were previously suppressed by "/FS" now reappear, for example when building ITK Debug configuration:
C:\src\ITK\Modules\ThirdParty\VNL\src\vxl\v3p\netlib\libf2c\c_div.c : fatal error C1090: PDB API call failed, error code ‘3’: C:\bin\ITK\lib\Debug\itkv3p_netlib-5.3.pdb
In order for "/FS" to be effective, it must be added to <AdditionalOptions>
, as CMake 3.20.5 did. A quick-fix could be to simply remove the "ForceSynchronousPDBWrites" entry from the CL flag tables in CMake/Templates/MSBuild/FlagTables (both in v142_CL.json and v143_CL.json).
Related issues:
ITK issue 2661: "Visual Studio 2019 16.10.4 VXL fatal error C1090: PDB API call failed, error code ‘3’" https://github.com/InsightSoftwareConsortium/ITK/issues/2661
Microsoft Developer Community: "VS2019 2019 16.10.4 no longer passes /FS to cl.exe (fatal error C1090: PDB API call failed, error code '3')" https://developercommunity.visualstudio.com/t/VS2019-2019-16104-no-longer-passes-FS/1482274