ecmwf / atlas-orca

atlas-orca plugin for Atlas, providing support for ORCA grids and mesh generation
Apache License 2.0
3 stars 6 forks source link

NETCDF_LIBRARIES keeps appending #12

Closed DJDavies2 closed 1 year ago

DJDavies2 commented 1 year ago

What happened?

Things seem to be working for me, but doing incremental builds of atlas-orca results in the NETCDF_LIBRARIES cmake variable being appended, and so it keeps growing with each incremental build. The builds still work, but it would be nice if it didn't happen.

What are the steps to reproduce the bug?

atlas-orca is included in a bundle, the bundle isn't public unfortunately.

There is a find_package( NetCDF REQUIRED COMPONENTS C CXX Fortran ) in the bundle CMakelists.txt, I don't know if that makes a difference?

Version

develop

Platform (OS and architecture)

Cray

Relevant log output

-- Adding bundle project atlas-orca
-- ---------------------------------------------------------
-- [atlas-orca] (0.1.1) [37615b6]
-- Feature TESTS enabled
-- Found OpenMP: TRUE (found version "4.5") found components: CXX 
-- Found NetCDF: /home/d00/darth/opt/bb-stack/cray_gnu-v28/include (found version "4.9.2") found components: CXX Fortran 
-- FindNetCDF defines targets:
--   - NetCDF_VERSION [4.9.2]
--   - NetCDF_PARALLEL [TRUE]
--   - NetCDF_C_CONFIG_EXECUTABLE [/home/d00/darth/opt/bb-stack/cray_gnu-v28/bin/nc-config]
--   - NetCDF::NetCDF_C [SHARED] [Root: /home/d00/darth/opt/bb-stack/cray_gnu-v28] Lib: /home/d00/darth/opt/bb-stack/cray_gnu-v28/lib64/libnetcdf.so 
--   - NetCDF_CXX_CONFIG_EXECUTABLE [/home/d00/darth/opt/bb-stack/cray_gnu-v28/bin/ncxx4-config]
--   - NetCDF::NetCDF_CXX [SHARED] [Root: /home/d00/darth/opt/bb-stack/cray_gnu-v28] Lib: /home/d00/darth/opt/bb-stack/cray_gnu-v28/lib64/libnetcdf_c++4.so 
--   - NetCDF_Fortran_CONFIG_EXECUTABLE [/home/d00/darth/opt/bb-stack/cray_gnu-v28/bin/nf-config]
--   - NetCDF::NetCDF_Fortran [SHARED] [Root: /home/d00/darth/opt/bb-stack/cray_gnu-v28] Lib: /home/d00/darth/opt/bb-stack/cray_gnu-v28/lib64/libnetcdff.so 
-- atlas-orca FOUND NetCDF (found version "4.9.2")
--    NetCDF_INCLUDE_DIRS : [/home/d00/darth/opt/bb-stack/cray_gnu-v28/include]
--    NETCDF_LIBRARIES : [/home/d00/darth/opt/bb-stack/cray_gnu-v28/lib64/libnetcdf.so /home/d00/darth/opt/bb-stack/cray_gnu-v28/lib64/libnetcdf_c++4.so /home/d00/darth/opt/bb-stack/cray_gnu-v28/lib64/libnetcdff.so /home/d00/darth/opt/bb-stack/cray_gnu-v28/lib64/libnetcdf.so /home/d00/darth/opt/bb-stack/cray_gnu-v28/lib64/libnetcdf_c++4.so /home/d00/darth/opt/bb-stack/cray_gnu-v28/lib64/libnetcdf.so /home/d00/darth/opt/bb-stack/cray_gnu-v28/lib64/libnetcdff.so /home/d00/darth/opt/bb-stack/cray_gnu-v28/lib64/libnetcdf.so /home/d00/darth/opt/bb-stack/cray_gnu-v28/lib64/libnetcdff.so /home/d00/darth/opt/bb-stack/cray_gnu-v28/lib64/libnetcdf.so /home/d00/darth/opt/bb-stack/cray_gnu-v28/lib64/libnetcdff.so /home/d00/darth/opt/bb-stack/cray_gnu-v28/lib64/libnetcdf.so /home/d00/darth/opt/bb-stack/cray_gnu-v28/lib64/libnetcdff.so /home/d00/darth/opt/bb-stack/cray_gnu-v28/lib64/libnetcdf.so /home/d00/darth/opt/bb-stack/cray_gnu-v28/lib64/libnetcdff.so /home/d00/darth/opt/bb-stack/cray_gnu-v28/lib64/libnetcdf.so /home/d00/darth/opt/bb-stack/cray_gnu-v28/lib64/libnetcdf.so /home/d00/darth/opt/bb-stack/cray_gnu-v28/lib64/libnetcdff.so /home/d00/darth/opt/bb-stack/cray_gnu-v28/lib64/libnetcdf.so /home/d00/darth/opt/bb-stack/cray_gnu-v28/lib64/libnetcdff.so /home/d00/darth/opt/bb-stack/cray_gnu-v28/lib64/libnetcdf.so /home/d00/darth/opt/bb-stack/cray_gnu-v28/lib64/libnetcdf_c++4.so /home/d00/darth/opt/bb-stack/cray_gnu-v28/lib64/libnetcdff.so /home/d00/darth/opt/bb-stack/cray_gnu-v28/lib64/libnetcdf.so /home/d00/darth/opt/bb-stack/cray_gnu-v28/lib64/libnetcdf_c++4.so /home/d00/darth/opt/bb-stack/cray_gnu-v28/lib64/libnetcdf.so /home/d00/darth/opt/bb-stack/cray_gnu-v28/lib64/libnetcdf_c++4.so /home/d00/darth/opt/bb-stack/cray_gnu-v28/lib64/libnetcdf.so /home/d00/darth/opt/bb-stack/cray_gnu-v28/lib64/libnetcdf_c++4.so /home/d00/darth/opt/bb-stack/cray_gnu-v28/lib64/libnetcdf.so /home/d00/darth/opt/bb-stack/cray_gnu-v28/lib64/libnetcdff.so /home/d00/darth/opt/bb-stack/cray_gnu-v28/lib64/libnetcdf.so /home/d00/darth/opt/bb-stack/cray_gnu-v28/lib64/libnetcdf_c++4.so /home/d00/darth/opt/bb-stack/cray_gnu-v28/lib64/libnetcdff.so /home/d00/darth/opt/bb-stack/cray_gnu-v28/lib64/libnetcdf.so /home/d00/darth/opt/bb-stack/cray_gnu-v28/lib64/libnetcdf_c++4.so /home/d00/darth/opt/bb-stack/cray_gnu-v28/lib64/libnetcdf.so /home/d00/darth/opt/bb-stack/cray_gnu-v28/lib64/libnetcdff.so /home/d00/darth/opt/bb-stack/cray_gnu-v28/lib64/libnetcdf.so /home/d00/darth/opt/bb-stack/cray_gnu-v28/lib64/libnetcdff.so /home/d00/darth/opt/bb-stack/cray_gnu-v28/lib64/libnetcdf.so /home/d00/darth/opt/bb-stack/cray_gnu-v28/lib64/libnetcdff.so /home/d00/darth/opt/bb-stack/cray_gnu-v28/lib64/libnetcdf.so /home/d00/darth/opt/bb-stack/cray_gnu-v28/lib64/libnetcdff.so /home/d00/darth/opt/bb-stack/cray_gnu-v28/lib64/libnetcdf.so /home/d00/darth/opt/bb-stack/cray_gnu-v28/lib64/libnetcdff.so /home/d00/darth/opt/bb-stack/cray_gnu-v28/lib64/libnetcdf.so /home/d00/darth/opt/bb-stack/cray_gnu-v28/lib64/libnetcdf.so /home/d00/darth/opt/bb-stack/cray_gnu-v28/lib64/libnetcdff.so /home/d00/darth/opt/bb-stack/cray_gnu-v28/lib64/libnetcdf.so /home/d00/darth/opt/bb-stack/cray_gnu-v28/lib64/libnetcdff.so /home/d00/darth/opt/bb-stack/cray_gnu-v28/lib64/libnetcdf.so /home/d00/darth/opt/bb-stack/cray_gnu-v28/lib64/libnetcdf_c++4.so /home/d00/darth/opt/bb-stack/cray_gnu-v28/lib64/libnetcdff.so /home/d00/darth/opt/bb-stack/cray_gnu-v28/lib64/libnetcdf.so /home/d00/darth/opt/bb-stack/cray_gnu-v28/lib64/libnetcdf_c++4.so /home/d00/darth/opt/bb-stack/cray_gnu-v28/lib64/libnetcdf.so /home/d00/darth/opt/bb-stack/cray_gnu-v28/lib64/libnetcdf_c++4.so /home/d00/darth/opt/bb-stack/cray_gnu-v28/lib64/libnetcdf.so /home/d00/darth/opt/bb-stack/cray_gnu-v28/lib64/libnetcdf_c++4.so /home/d00/darth/opt/bb-stack/cray_gnu-v28/lib64/libnetcdf.so /home/d00/darth/opt/bb-stack/cray_gnu-v28/lib64/libnetcdff.so /home/d00/darth/opt/bb-stack/cray_gnu-v28/lib64/libnetcdf.so /home/d00/darth/opt/bb-stack/cray_gnu-v28/lib64/libnetcdf_c++4.so /home/d00/darth/opt/bb-stack/cray_gnu-v28/lib64/libnetcdff.so /home/d00/darth/opt/bb-stack/cray_gnu-v28/lib64/libnetcdf.so /home/d00/darth/opt/bb-stack/cray_gnu-v28/lib64/libnetcdf_c++4.so /home/d00/darth/opt/bb-stack/cray_gnu-v28/lib64/libnetcdff.so]
-- Feature NETCDF enabled

Accompanying data

No response

Organisation

Met Office

wdeconinck commented 1 year ago

Hi @DJDavies2 , I don't have the same problem:

-- [atlas-orca] (0.1.1) [9e96b12]
-- Feature TESTS enabled
-- Feature INSTALL_ORCA_DATA enabled
-- FindNetCDF defines targets:
--   - NetCDF::NetCDF_C [/opt/homebrew/lib/libnetcdf.dylib]
--   - NetCDF::NetCDF_CXX [/opt/homebrew/lib/libnetcdf-cxx4.dylib]
-- atlas-orca FOUND NetCDF (found version "4.9.2")
-- Found package NetCDF required for feature NETCDF
-- Feature NETCDF enabled

ecbuild_find_package will print the NETCDF_LIBRARIES only if it is defined. The ecbuild-provided FindNetCDF.cmake will not define this variable. Furthermore this variable is never used as the executable that links with NetCDF uses the NetCDF::NetCDF_CXX target, which in your case seems correct.

My hunch is that you are using a different (or older?) "FindNetCDF.cmake" somehow?

DJDavies2 commented 1 year ago

Yes, it is possible that this is due to a different FindNetCDF.cmake, I will investigate and confirm.

DJDavies2 commented 1 year ago

So what is happening is that a) a different FindNetCDF.cmake is being used (from jedi-cmake) and also this is being used in a bundle where the NetCDF library has already been detected prior to atlas-orca. I shall have to think of something else.