About _GLIBCXX_USE_CXX11_ABI

We are developping plugins for applications that just recently switch to the new C++ ABI on linux (Dual ABI)
So here is my problem. I need to compile my plugins with
–for the new ABI
target_compile_definitions(${target_name} PUBLIC _GLIBCXX_USE_CXX11_ABI=1)
–for the old ABI
target_compile_definitions(${target_name} PUBLIC _GLIBCXX_USE_CXX11_ABI=0)

Thta works great until we start using external libraries. If in understood well the external libraries also need to be compiled with the same value of _GLIBCXX_USE_CXX11_ABI.

Now we use find_package for all library dependencies. However i dont see any parameters that would allow me to ask find_package to find with _GLIBCXX_USE_CXX11_ABI enabled or disables.

I can always create my own findXXX.cmake files to make it happen but i was wondering if there was a standard way of getting the right library.

Thank you in advance for you help.

1 Like

We couldn’t find a built-in solution to handle this gracefully either. However, we currently use a workaround: we have two sets of library root paths (with and without the new ABI) in two separate files. In CMake, we simply include the appropriate one for each build type.

That is actually what we do within some findXXX.cmake to avoid making it hapen in each project. i glad i m not the only one having this issue.

1 Like