CMake: fix lib hack for OSX

External libraries (i.e. libraries that are not included in the repo)
should be passed to target_link_libraries() by using variables set
by find_package() and find_library(). Else, the linking will fail
if the libraries are not found in the default library search paths
which can be different on every platform.
Merge pull request #150 from toxeus/fixCMakeHack

Fix CMake hack