title: Write CMake Find Netcdf for C and Fortran library
body: <p>Hi everybody and thanks to your help,</p>
  
  <p>I'm newbie of CMAKE and I try to write a find library for C and Fortran NETCDF library. The problem is the possible different location and version of fortran and C netcdf. </p>
  
  <p>For fortran library I search <strong>netcdf.mod</strong>(include module) and <strong>libnetcdff.so</strong> (dynamic library) instead for C library I search <strong>netcdf.h</strong> and <strong>libnetcdf.so</strong>. </p>
  
  <p>On the web I find a magic code that find correctly the netcdf C library :</p>
  
  <pre><code>find_path (NETCDF_INCLUDES_C netcdf.h HINTS NETCDF_DIR NETCDF_DIR)
  message(" inc =  ${NETCDF_INCLUDES_C}  ")
  find_library (NETCDF_LIBRARIES_C  NAMES netcdf)
  message(" lib =  ${NETCDF_LIBRARIES_C}  ")
  </code></pre>
  
  <p>and the two path is correct. I try to reply the code for fortran:</p>
  
  <pre><code>find_path (NETCDFF_INCLUDES_F90 netcdff.mod HINTS NETCDFF_DIR NETCDFF_DIR)
  message(" inc ff =  ${NETCDFF_INCLUDES_F90}  ")
  find_library (NETCDFF_LIBRARIES_F90  NAMES netcdff HINTS NETCDFF_DIR )
  message(" lib ff=  ${NETCDFF_LIBRARIES_F90}  ")
  mark_as_advanced(NETCDF_LIBRARIES_F90)
  </code></pre>
  
  <p>but the both F90 path is empty, probably because I don't understand how cmake find the C library. Through MODULE ENVIRONMENT i load both library and the module load that env var:</p>
  
  <pre><code>   $NETCDFF_HOME $NETCDFF_INC $NETCDFF_INCLUDE $NETCDFF_LIB
     $NETCDF_HOME  $NETCDF_INC  $NETCDF_INCLUDE  $NETCDF_LIB 
  </code></pre>
  
  <p>I suppose incorrectly that CMAKE search NETCDF_DIR variable and into this search netcdf.h but in my CmakeList and in my ENV that variable is not defined.</p>
  
  <p>How CMake find C var? and how I can reply the find to fortran lib?</p>
  
  <p>Thanks to help me</p>
  
  <p>Best regards</p>
  
  <p>Eric</p>