[CMake] Comaptibility with older gcc
Zan Lynx
zlynx at acm.org
Fri Jan 27 13:05:19 EST 2017
On 1/27/2017 10:04 AM, Michele Portolan wrote:
> I have a project that build correctly using gcc 4.9.3, generating a
> dynamic library that I can later link to obtain my executables. So,
> nothing special.
>
> My problem is that on one of my target systems, I only have a gcc 4.1.2
> and I am forced to use it for at least linking the last executable. My
> project uses extensively C++14,so I cannot build it with the older gcc.
>
> Is there a way to have Cmake generate a library that is compatible with
> gcc 4.1.2?
I think your choices are to rewrite without C++14 or to include all of
the static C++ support libraries into your library.
You will need to make all your symbols hidden and then explicitly mark
what you want exported. You should be doing that anyway of course. And
when linking in the static libraries you will want to be sure that ld in
the link step is using -exclude-libs ALL option. Because if any C++14
symbols escape from your .so it will screw up the C++03 link.
Also, you won't be able to pass any complex objects or exceptions
between libraries because the internal implementation of std::list and
std::string has changed from 2003 to 2014.
More information about the CMake
mailing list