CMake issueshttps://gitlab.kitware.com/cmake/cmake/-/issues2018-04-16T11:57:20-04:00https://gitlab.kitware.com/cmake/cmake/-/issues/17436CMake no longer excludes libgcc_eh from the implicit link libraries2018-04-16T11:57:20-04:00Marc AldorasiCMake no longer excludes libgcc_eh from the implicit link librariesCommit d59e3509850329096a7d6dfbc037d721b70034c9 removed `gcc.*` from the list of filtered implicit link libraries. This causes CMake to add `-lgcc_eh` to the linker flags when compiling a mixed C/C++ project on mingw, which means `libgc...Commit d59e3509850329096a7d6dfbc037d721b70034c9 removed `gcc.*` from the list of filtered implicit link libraries. This causes CMake to add `-lgcc_eh` to the linker flags when compiling a mixed C/C++ project on mingw, which means `libgcc_eh.a` is statically linked into every binary. This means that each dll has its own copy of exception handling and TLS code, which can cause problems (see https://public.kitware.com/pipermail/cmake/2017-August/066128.html for an example). In addition, the GCC developers recommend against having multiple copies of libgcc_eh at runtime (see https://gcc.gnu.org/ml/gcc/2012-03/msg00104.html).
As a workaround, adding `list(REMOVE_ITEM CMAKE_C_IMPLICIT_LINK_LIBRARIES gcc_eh)` will stop it from being implicitly linked.
`gcc_eh.*` should be added to the list of filtered implicit link libraries to fix this problem.3.9.6Christian PfeifferChristian Pfeiffer