CMAKE_PREFIX_PATH does not work as expected

Using ~ in a CMake path isn’t going to help much. You should use $HOME (on the shell) or $ENV{HOME} (in CMake code) instead.