Fixes #1380: incorrect usage of CMake paths which causes issues on some more complicated environments (NixOS especially).