diff --git a/CMakeLists.txt b/CMakeLists.txt index ce456815b..25bce3375 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -473,7 +473,24 @@ set(FCFLAGS "${CMAKE_Fortran_FLAGS} ${CMAKE_Fortran_FLAGS_${CMAKE_BUILD_TYPE}}") set(LDFLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${CMAKE_SHARED_LINKER_FLAGS_${CMAKE_BUILD_TYPE}}") set(VERSION ${PROJECT_VERSION}) -#set(LIBS ?) + +# https://cmake.org/cmake/help/latest/module/FindMPI.html +string(REPLACE ";" " " LIBS "${MPI_C_LIBRARIES};${MPI_Fortran_LIBRARIES} ") + +if(NOT ${NetCDF_Fortran_LIBRARY_SHARED}) + # autotools: Libs.private: -lnetcdff -lnetcdf + string(APPEND LIBS ${NetCDF_Fortran_LIBRARIES}) +endif() + +if (OPENMP) + # https://cmake.org/cmake/help/latest/module/FindOpenMP.html + string(REPLACE ";" " " TMP_LIBS "${OPENMP_C_LIBRARIES};${OPENMP_Fortran_LIBRARIES} ") + string(APPEND LIBS ${TMP_LIBS}) +endif() + +if (WITH_YAML) + string(APPEND LIBS ${LIBYAML_LIBRARIES}) +endif() configure_file(${CMAKE_CURRENT_SOURCE_DIR}/FMS.pc.in ${CMAKE_CURRENT_BINARY_DIR}/FMS.pc @ONLY)