Using -get_filename_component() to compute the install prefix is fragile and subject to breakage in the presence of symbolic links. We know the install prefix via CMAKE_INSTALL_PREFIX, so use it.
This came out of part of my work testing parallel installable versions of llvm/clang for Fedora, and looking to be able to have clang's CMakeLists.txt be able to do:
find_package(LLVM 3.9 REQUIRED) list(APPEND CMAKE_MODULE_PATH "${LLVM_CMAKE_DIR}")
to locate llvm.