Advice on CMake code (total newbie here)

Hello,

I just wrote my first CMake code today, after reading part of the CMake tutorial yesterday and while it does work so far, I was hoping to get some advice from more experienced CMakes users, since I’m sure the code is not very elegant and could be improved.

All the source code is in the project’s src directory, it is hybrid MPI+OpenMP code written in Fortran+C and it uses HDF5. By default I want a RELEASE build and the code installed in the build directory itself. I have two user options to select whether OpenMP (-DOpenMP) and the C code (-DGAUSS_C) should be used.

My main concern is that the code will be installed in different environments, with different compilers and compiler versions, so I need to take care of that in a clean and robust way. So far I have tried with different compilers: gnu, intel and cray.

I just have two CMakeLists.txt files, and I would be really grateful if you could give me some advice/suggestions on how to improve them. Since I cannot upload files here, I link them with transfer.sh. The file in the root directory: https://transfer.sh/XGpanD/CMakeLists.txt and the one in the src directory: https://transfer.sh/LYpTQ5/src_CMakeLists.txt

Many thanks,
AdV