ECC-13: install eccodes module in build dir for examples/F90

This commit is contained in:
Shahram Najm 2015-01-07 16:12:11 +00:00
parent 814db57f3e
commit c8a2e90ed3
1 changed files with 19 additions and 10 deletions

View File

@ -38,6 +38,21 @@ if( EC_HAVE_FORTRAN )
GENERATED grib_f90.f90
LIBS grib_api )
# Add the eccodes module file as well
set(_eccodes_mod "${CMAKE_Fortran_MODULE_DIRECTORY}/eccodes.mod" )
add_custom_command(
OUTPUT ${_eccodes_mod}
#WORKING_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}
#COMMAND ${CMAKE_COMMAND} -E create_symlink "${CMAKE_Fortran_MODULE_DIRECTORY}/grib_api.mod" ${_eccodes_mod}
COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_Fortran_MODULE_DIRECTORY}/grib_api.mod" ${_eccodes_mod}
DEPENDS grib_api_f90
VERBATIM
)
add_custom_target(add_eccodes_mod ALL DEPENDS ${_eccodes_mod})
ecbuild_add_resources( TARGET fortran_resources
PACK
grib_fortran_prototypes.h grib_api_constants.h grib_api_externals.h
@ -46,6 +61,10 @@ if( EC_HAVE_FORTRAN )
grib_f90_int_size_t.f90 grib_f90_long_size_t.f90
same_int_long.f90 same_int_size_t.f90 grib_fortran_kinds.c )
### installation
install( FILES grib_api_f77.h DESTINATION ${INSTALL_INCLUDE_DIR} )
# Install the generated .mod file
@ -68,15 +87,5 @@ if( EC_HAVE_FORTRAN )
OPTIONAL
DESTINATION ${INSTALL_INCLUDE_DIR} )
# After the installation, make the eccodes module file a symlink to the grib_api one
#install(CODE
# "
# EXECUTE_PROCESS(
# COMMAND ${CMAKE_COMMAND} -E chdir ${CMAKE_INSTALL_PREFIX}/${INSTALL_INCLUDE_DIR}
# ${CMAKE_COMMAND} -E create_symlink grib_api.mod eccodes.mod
# )
# "
#)
endif()