tomaskubar / gromacs-dftbplus

Public/backup repository of the GROMACS molecular simulation toolkit. Please do not mine the metadata blindly; we use Gerrit for code review and Redmine for issue tracking.
http://www.gromacs.org
Other
5 stars 2 forks source link

linking with gfortran #5

Closed Golovin-Andrey closed 4 years ago

Golovin-Andrey commented 5 years ago

Dear @tomaskubar , I faced with linking mess in ubuntu with libgfortran, and a possible solution could be adding to src/programs/CMakeLists.txt

find_library(GFORTRAN                                                                                                                                                 
    NAMES libgfortran.so.4      libgfortran.so.4.0.0                                                                                                                      
    PATH /usr/              # may be use LD_LIBRARY_PATH ?
)
add_library(gfortran SHARED IMPORTED)                                                                                                                             
set_target_properties(gfortran PROPERTIES IMPORTED_LOCATION ${GFORTRAN} )                                                                                         
    if(GMX_BUILD_MDRUN_ONLY)                                                                                                                                              
        target_link_libraries(mdrun libdftbplus libxmlf90 libdftd3 gfortran )                                                                                    
    else()                                                                                                                                                                
        target_link_libraries(gmx libdftbplus libxmlf90 libdftd3 gfortran)   

Probably more generalized solution could be done in a manner like in ./cmake/FindHwloc.cmake Andrey

tomaskubar commented 4 years ago

Dear Andrey Thanks for the idea. I used a part of the mechanism from cmake/FindHwloc.cmake, and it works in my hands. Not sure why it took me so long though :-/