From a3fdc7fdf7bf1454badf94f3b393eefb8339f359 Mon Sep 17 00:00:00 2001 From: Harshula Jayasuriya Date: Wed, 18 Sep 2024 23:40:25 +1000 Subject: [PATCH] CMakeLists.txt: Set LIBS when NetCDF is a static library --- CMakeLists.txt | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 4c8357b64..aed1a0af8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -475,7 +475,15 @@ 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 ?) + +# TODO: If FMS depends on a library that is built as a static library, it +# should be listed here as an ldflag. +set(LIBS "") + +if(NOT ${NetCDF_Fortran_LIBRARY_SHARED}) + # autotools: Libs.private: -lnetcdff -lnetcdf + string(APPEND LIBS ${NetCDF_Fortran_LIBRARIES}) +endif() configure_file(${CMAKE_CURRENT_SOURCE_DIR}/FMS.pc.in ${CMAKE_CURRENT_BINARY_DIR}/FMS.pc @ONLY)