Improvements to CMake documentation / output
- I think that two sentences in
INSTALL.CMakecould be misleading:but later in the same file:If MPI is found on the system, it will be used by default (WITH_MPI=ON). If NetCDF is found on the system, it will be used by default (WITH_NETCDF=ON), and so will the NCDF library (See below for a fuller option list).where the defaults do not depend on the libraries found on the system. A reader could interpret the first two sentences as saying that those defaults take those values only if the corresponding libraries are found on the system. I believe that those defaults indeed do not depend on what is found on the system, at least with the MPI one the default is to fail if MPI is not found and it has not been explicitly disabled:- WITH_MPI: It is ON by default. To deactivate, use -DWITH_MPI=OFF [...] - WITH_NETCDF: It is ON by default. At the same time, it will set WITH_NCDF to ON. WITH_NCDF_PARALLEL will remain OFF by default.Please let's clarify whether we want to improve those texts (and keep the current implementation of defaults) or make the defaults dependent on the libraries found on the system.$ cmake -S. -B_build [...] -- Could NOT find MPI_C (missing: MPI_C_LIB_NAMES MPI_C_HEADER_DIR MPI_C_WORKS) -- Could NOT find MPI_Fortran (missing: MPI_Fortran_LIB_NAMES MPI_Fortran_F77_HEADER_DIR MPI_Fortran_MODULE_DIR MPI_Fortran_WORKS) -- Could NOT find MPI (missing: MPI_C_FOUND MPI_Fortran_FOUND) Reason given by package: MPI component 'CXX' was requested, but language CXX is not enabled. -- MPI could not be found by CMake -- Try setting MPI_Fortran_COMPILER to an MPI wrapper, or the MPI_HOME env variable -- If unsuccessful, set -DWITH_MPI=OFF CMake Error at CMakeLists.txt:73 (message): MPI could not be found by CMake -- Configuring incomplete, errors occurred! - If NetCDF is enabled but not present in the system, the error message that is printed in red (lines 5-18 below) contains wrong information:
Would it be possible to print a clean error about not finding NetCDF, without entering Config/cmake/FindNetCDF.cmake:225 ?
Package netcdf was not found in the pkg-config search path. Perhaps you should add the directory containing `netcdf.pc' to the PKG_CONFIG_PATH environment variable No package 'netcdf' found CMake Error at Config/cmake/FindNetCDF.cmake:225 (message): Unable to properly find NetCDF. Found static libraries at: /users/escartin/siesta/NetCDF_C_LIBRARY-NOTFOUND but could not run nc-config: Call Stack (most recent call first): CMakeLists.txt:128 (find_package) CMake Error at Config/cmake/FindNetCDF.cmake:225 (message): Unable to properly find NetCDF. Found static libraries at: /users/escartin/siesta/NetCDF_Fortran_LIBRARY-NOTFOUND but could not run nc-config: Call Stack (most recent call first): CMakeLists.txt:128 (find_package) -- Could NOT find NetCDF (missing: NetCDF_INCLUDE_DIRS NetCDF_LIBRARIES) (Required is at least version "4.0.0") -- Looking for Fortran sgemm [...]