I recently tried upgrading CMake and got an unexpected build failure with Visual Studio 2022 suddenly returning LNK1189 (>65k symbols) for a large private project. After a bunch of testing different versions, it looks like the upgrade from CMake 4.0 to 4.1 changes the build flags in a way that results in a ton more symbols being exported when CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS is enabled.
The large failing project is private, but I created a minimal test project to debug what flags changed. I attached some text files with the flag lists for a minimal .dll test project, and it looks like /Zc:wchar_t, /Zc:inline, and /Zc:forScope were removed. From looking at the MSVC docs, /Zc:inline (Remove unreferenced COMDAT) seems like the most likely cause of LNK1189, since it was likely removing unused symbols that are now getting exported.
Was this change intended? I tried reading over the CMake 4.1 release notes, but haven’t seen anything that describes the changes I’m seeing.
simple_flags_4.0.4.txt (1.2 KB)
simple_flags_4.1.2.txt (1.1 KB)
CMakeLists.txt (1.0 KB)