Now it's obvious: my problem (and solution) with FreeBSD and Adam's problem with debian are different; so FreeBSD is off-topc here. Anyway I seem if (${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD") set(TIDY_NAMES tidy5) is a normal solution when an OS manages some different version of a library renaming it. In this specific case, it fixes incompatibility between headers and linked library. Properly: /usr/local/include/tidy/tidy.h and tidy.so are libtidy.0.99 (www/tidy-lib port) while the right is /usr/local/include/tidy.h and tidy5.so (www/tidy-html5 port) cmake finds the correct tidy.h but it cannot find the right ".so" without: set(TIDY_NAMES tidy5), of course a better solution is welcome. Alfonso