The prerequisites are:
The build steps are:
Reconfiguring ld (may be needed):
Sometimes it helps to remove the CMakeCache.txt (configuration cache) in the src directory .
If you have MPI installed, then this is probably a bug of the cmake module FindMPI.cmake. To fix it add a space before -l at the lines 205 and 211 (at least in cmake 2.6-patch 4). The whole block starting from line 203:
# Extract the set of libraries to link against from the link command # line string(REGEX MATCHALL " -l([^\" ]+|\"[^\"]+\")" MPI_LIBNAMES "${MPI_LINK_CMDLINE}") # Determine full path names for all of the libraries that one needs # to link against in an MPI program set(MPI_LIBRARIES) foreach(LIB ${MPI_LIBNAMES}) string(REGEX REPLACE "^ -l" "" LIB ${LIB}) set(MPI_LIB "MPI_LIB-NOTFOUND" CACHE FILEPATH "Cleared" FORCE) find_library(MPI_LIB ${LIB} HINTS ${MPI_LINK_PATH}) if (MPI_LIB) list(APPEND MPI_LIBRARIES ${MPI_LIB}) else (MPI_LIB) message(SEND_ERROR "Unable to find MPI library ${LIB}") endif (MPI_LIB) endforeach(LIB)
reconfigure ld (like described above in the installation instructions)