From e1d88931929840e77e36817b254fdb8a4ec155ec Mon Sep 17 00:00:00 2001 From: Shahram Najm Date: Tue, 30 Dec 2014 12:53:08 +0000 Subject: [PATCH] GRIB-665: cmake build does not install Fortran module --- fortran/CMakeLists.txt | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/fortran/CMakeLists.txt b/fortran/CMakeLists.txt index d7ef0781d..aaee5817c 100644 --- a/fortran/CMakeLists.txt +++ b/fortran/CMakeLists.txt @@ -48,17 +48,25 @@ if( EC_HAVE_FORTRAN ) install( FILES grib_api_f77.h DESTINATION ${INSTALL_INCLUDE_DIR} ) - install( CODE "EXECUTE_PROCESS (COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_Fortran_MODULE_DIRECTORY}/${CMAKE_CFG_INTDIR} ${CMAKE_INSTALL_PREFIX}/${INSTALL_INCLUDE_DIR})" ) + # Install the generated .mod file + # install( CODE "EXECUTE_PROCESS (COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_Fortran_MODULE_DIRECTORY}/${CMAKE_CFG_INTDIR} ${CMAKE_INSTALL_PREFIX}/${INSTALL_INCLUDE_DIR})" ) + install( FILES ${CMAKE_Fortran_MODULE_DIRECTORY}/${CMAKE_CFG_INTDIR}/grib_api.mod + DESTINATION ${INSTALL_INCLUDE_DIR} ) + + # Install also as the eccodes module file + install( FILES ${CMAKE_Fortran_MODULE_DIRECTORY}/${CMAKE_CFG_INTDIR}/grib_api.mod + RENAME eccodes.mod + 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 - ) - " - ) + #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()