[CMake] Fix libraries lookup, remove unused dependencies