Disable install test on macOS + Fortran + MPI
Created by: KyleFromKitware
mpifort adds a -Wl,-flat_namespace flag, which, in conjunction with an ugly Xcode bug (http://www.openradar.me/25313838), prohibits the use of rpaths to locate the libraries. Therefore, in commit a80afca4, the configure-time value of ${CMAKE_INSTALL_PREFIX} was used as the install name directory instead of @rpath, and CMAKE_MACOSX_RPATH was also set to OFF if macOS + Fortran + MPI was detected.
Unfortunately, the install test changes ${CMAKE_INSTALL_PREFIX} at install time, which results in the test failing due to the executable searching in the wrong directory for the libraries. It may be possible to dynamically set the correct install name directory at install time, using some combination of install(SCRIPT), file(GENERATE), and install_name_tool. However, for the sake of simplicity, we have chosen to simply disable the test under these circumstances.
Disable the install test if macOS + Fortran + MPI is detected. Enable it otherwise. In addition, allow rpath to work if this combination is not detected, by not setting CMAKE_INSTALL_NAME_DIR and setting CMAKE_INSTALL_RPATH to @loader_path, which is the macOS equivalent of Linux's ${ORIGIN}.