Merge pull request #9177 from vovkasm/cmake-unify-usage-of-prebuilt-libraries

Cmake unify usage of prebuilt libraries
Quick and dirty fix after my error. This defines fix build on linux with fresh gcc, but broke on mac
Merge pull request #9180 from vovkasm/cmake-mac-quick-fix

Quick and dirty fix after my error. This defines fix build on linux with...