Fixed Unknown CMake command "CHECK_LIBRARY_EXISTS" error on Unix targets

Previously it worked somehow but not with CMake 3.0.2