[CMake] Proper way to find system copy of libxml2 on macOS

Konstantin Tokarev annulen at yandex.ru
Wed Oct 12 11:28:09 EDT 2016


Hello,

In my cmake project I need to use system version of libxml2 on macOS (/usr/lib/libxml2.dylib), however in case it is installed in MacPorts the latter version is picked by find_package. On the other hand I'd like to avoid hardcoding absolute path, just in case Apple changes some path or file name in future OS version.

I've tried 

find_package(LibXml2 2.8.0 REQUIRED PATHS "/usr" NO_DEFAULT_PATH)

however it fails to find anything at all. Any ideas?

-- 
Regards,
Konstantin


More information about the CMake mailing list