Hi, I'm a beginner trying to package MPAS-A 8.4.0 for guix-science (see pull request [1]).
As a first step, I'd like to use SMIOL and the compilation and tutorial [2] exercises
seem to work with the build.
However, there is a problem with cmake exports: in a trivial cmake project with just a
CMakeLists.txt like this:
```
cmake_minimum_required(VERSION 3.10)
project(testproject LANGUAGES C Fortran)
set(CMAKE_BUILD_TYPE Debug)
# CMake: Is there a way to get a list of imported targets that belong to a package
get_property(importTargets DIRECTORY "${CMAKE_SOURCE_DIR}" PROPERTY IMPORTED_TARGETS)
find_package(MPAS 8.0 REQUIRED COMPONENTS DOUBLE_PRECISION core_atmosphere)
get_property(importTargetsAfter DIRECTORY "${CMAKE_SOURCE_DIR}" PROPERTY IMPORTED_TARGETS)
list(REMOVE_ITEM importTargetsAfter ${importTargets})
message("${importTargetsAfter}")
```
an error occurs:
```
-- The C compiler identification is GNU 14.3.0
-- The Fortran compiler identification is GNU 14.3.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /gnu/store/anz0ihw20jql06i3kxb6vn0ca1sfisb7-profile/bin/gcc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting Fortran compiler ABI info
-- Detecting Fortran compiler ABI info - done
-- Check for working Fortran compiler: /gnu/store/anz0ihw20jql06i3kxb6vn0ca1sfisb7-profile/bin/gfortran - skipped
-- Found OpenMP_Fortran: -fopenmp (found version "4.5")
-- Found OpenMP: TRUE (found version "4.5") found components: Fortran
-- Found MPI_Fortran: /gnu/store/anz0ihw20jql06i3kxb6vn0ca1sfisb7-profile/lib/libmpi_usempif08.so (found version "3.1")
-- Found MPI: TRUE (found version "3.1") found components: Fortran
-- Found NetCDF: /gnu/store/anz0ihw20jql06i3kxb6vn0ca1sfisb7-profile/include (found version "4.9.2") found components: Fortran
-- FindNetCDF [/gnu/store/7da85x6xhm6kl7xdh13v1njj5n7s6xjf-mpas-atmosphere-8.4.0/lib/cmake/MPAS/Modules/FindNetCDF.cmake]:
-- - NetCDF_VERSION [4.9.2]
-- - NetCDF_PARALLEL [TRUE]
-- - NetCDF_C_CONFIG_EXECUTABLE [/gnu/store/anz0ihw20jql06i3kxb6vn0ca1sfisb7-profile/bin/nc-config]
-- - NetCDF::NetCDF_C [SHARED] [Root: /gnu/store/anz0ihw20jql06i3kxb6vn0ca1sfisb7-profile] Lib: /gnu/store/anz0ihw20jql06i3kxb6vn0ca1sfisb7-profile/lib/libnetcdf.so
-- - NetCDF_Fortran_CONFIG_EXECUTABLE [/gnu/store/anz0ihw20jql06i3kxb6vn0ca1sfisb7-profile/bin/nf-config]
-- - NetCDF::NetCDF_Fortran [SHARED] [Root: /gnu/store/anz0ihw20jql06i3kxb6vn0ca1sfisb7-profile] Lib: /gnu/store/anz0ihw20jql06i3kxb6vn0ca1sfisb7-profile/lib/libnetcdff.so
-- Found PnetCDF: /gnu/store/anz0ihw20jql06i3kxb6vn0ca1sfisb7-profile/bin/pnetcdf-config (found version "1.13.0") found components: Fortran
-- FindPnetCDF:
-- - PnetCDF_VERSION [1.13.0]
-- - PnetCDF_PREFIX [/gnu/store/awcpg8g02yjk0jyfcy0vlixark7fcb5d-pnetcdf-fortran-1.13.0]
-- - PnetCDF Components Found: Fortran;C;CXX
CMake Error at /gnu/store/anz0ihw20jql06i3kxb6vn0ca1sfisb7-profile/share/cmake-4.1/Modules/FindPackageHandleStandardArgs.cmake:227 (message):
Could NOT find PIO (missing: PIO_PREFIX PIO_INCLUDE_DIR Fortran C)
Call Stack (most recent call first):
/gnu/store/anz0ihw20jql06i3kxb6vn0ca1sfisb7-profile/share/cmake-4.1/Modules/FindPackageHandleStandardArgs.cmake:591 (_FPHSA_FAILURE_MESSAGE)
/gnu/store/7da85x6xhm6kl7xdh13v1njj5n7s6xjf-mpas-atmosphere-8.4.0/lib/cmake/MPAS/Modules/FindPIO.cmake:93 (find_package_handle_standard_args)
/gnu/store/7da85x6xhm6kl7xdh13v1njj5n7s6xjf-mpas-atmosphere-8.4.0/lib/cmake/MPAS/mpas-config.cmake:104 (find_package)
CMakeLists.txt:7 (find_package)
-- Configuring incomplete, errors occurred!
```
Note the line
```
Could NOT find PIO (missing: PIO_PREFIX PIO_INCLUDE_DIR Fortran C)
```
Is it possible that there should be some condition excluding the line
```
find_package(PIO REQUIRED COMPONENTS Fortran C)
```
in the file
```
MPAS-Model/cmake/PackageConfig.cmake.in
```
when `MPAS_USE_PIO=OFF` ?
I'm not sure if there is currently any use of the cmake exports other than for the JCSDA mpas-jedi project, which
AFAIK requires PIO, but cmake produces export configuration files whether or not PIO is used.
THANKS FOR YOUR HELP!
[1] https://codeberg.org/guix-science/guix-science/pulls/648
[2] MPAS Tutorial — Practice Session Guide
As a first step, I'd like to use SMIOL and the compilation and tutorial [2] exercises
seem to work with the build.
However, there is a problem with cmake exports: in a trivial cmake project with just a
CMakeLists.txt like this:
```
cmake_minimum_required(VERSION 3.10)
project(testproject LANGUAGES C Fortran)
set(CMAKE_BUILD_TYPE Debug)
# CMake: Is there a way to get a list of imported targets that belong to a package
get_property(importTargets DIRECTORY "${CMAKE_SOURCE_DIR}" PROPERTY IMPORTED_TARGETS)
find_package(MPAS 8.0 REQUIRED COMPONENTS DOUBLE_PRECISION core_atmosphere)
get_property(importTargetsAfter DIRECTORY "${CMAKE_SOURCE_DIR}" PROPERTY IMPORTED_TARGETS)
list(REMOVE_ITEM importTargetsAfter ${importTargets})
message("${importTargetsAfter}")
```
an error occurs:
```
-- The C compiler identification is GNU 14.3.0
-- The Fortran compiler identification is GNU 14.3.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /gnu/store/anz0ihw20jql06i3kxb6vn0ca1sfisb7-profile/bin/gcc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting Fortran compiler ABI info
-- Detecting Fortran compiler ABI info - done
-- Check for working Fortran compiler: /gnu/store/anz0ihw20jql06i3kxb6vn0ca1sfisb7-profile/bin/gfortran - skipped
-- Found OpenMP_Fortran: -fopenmp (found version "4.5")
-- Found OpenMP: TRUE (found version "4.5") found components: Fortran
-- Found MPI_Fortran: /gnu/store/anz0ihw20jql06i3kxb6vn0ca1sfisb7-profile/lib/libmpi_usempif08.so (found version "3.1")
-- Found MPI: TRUE (found version "3.1") found components: Fortran
-- Found NetCDF: /gnu/store/anz0ihw20jql06i3kxb6vn0ca1sfisb7-profile/include (found version "4.9.2") found components: Fortran
-- FindNetCDF [/gnu/store/7da85x6xhm6kl7xdh13v1njj5n7s6xjf-mpas-atmosphere-8.4.0/lib/cmake/MPAS/Modules/FindNetCDF.cmake]:
-- - NetCDF_VERSION [4.9.2]
-- - NetCDF_PARALLEL [TRUE]
-- - NetCDF_C_CONFIG_EXECUTABLE [/gnu/store/anz0ihw20jql06i3kxb6vn0ca1sfisb7-profile/bin/nc-config]
-- - NetCDF::NetCDF_C [SHARED] [Root: /gnu/store/anz0ihw20jql06i3kxb6vn0ca1sfisb7-profile] Lib: /gnu/store/anz0ihw20jql06i3kxb6vn0ca1sfisb7-profile/lib/libnetcdf.so
-- - NetCDF_Fortran_CONFIG_EXECUTABLE [/gnu/store/anz0ihw20jql06i3kxb6vn0ca1sfisb7-profile/bin/nf-config]
-- - NetCDF::NetCDF_Fortran [SHARED] [Root: /gnu/store/anz0ihw20jql06i3kxb6vn0ca1sfisb7-profile] Lib: /gnu/store/anz0ihw20jql06i3kxb6vn0ca1sfisb7-profile/lib/libnetcdff.so
-- Found PnetCDF: /gnu/store/anz0ihw20jql06i3kxb6vn0ca1sfisb7-profile/bin/pnetcdf-config (found version "1.13.0") found components: Fortran
-- FindPnetCDF:
-- - PnetCDF_VERSION [1.13.0]
-- - PnetCDF_PREFIX [/gnu/store/awcpg8g02yjk0jyfcy0vlixark7fcb5d-pnetcdf-fortran-1.13.0]
-- - PnetCDF Components Found: Fortran;C;CXX
CMake Error at /gnu/store/anz0ihw20jql06i3kxb6vn0ca1sfisb7-profile/share/cmake-4.1/Modules/FindPackageHandleStandardArgs.cmake:227 (message):
Could NOT find PIO (missing: PIO_PREFIX PIO_INCLUDE_DIR Fortran C)
Call Stack (most recent call first):
/gnu/store/anz0ihw20jql06i3kxb6vn0ca1sfisb7-profile/share/cmake-4.1/Modules/FindPackageHandleStandardArgs.cmake:591 (_FPHSA_FAILURE_MESSAGE)
/gnu/store/7da85x6xhm6kl7xdh13v1njj5n7s6xjf-mpas-atmosphere-8.4.0/lib/cmake/MPAS/Modules/FindPIO.cmake:93 (find_package_handle_standard_args)
/gnu/store/7da85x6xhm6kl7xdh13v1njj5n7s6xjf-mpas-atmosphere-8.4.0/lib/cmake/MPAS/mpas-config.cmake:104 (find_package)
CMakeLists.txt:7 (find_package)
-- Configuring incomplete, errors occurred!
```
Note the line
```
Could NOT find PIO (missing: PIO_PREFIX PIO_INCLUDE_DIR Fortran C)
```
Is it possible that there should be some condition excluding the line
```
find_package(PIO REQUIRED COMPONENTS Fortran C)
```
in the file
```
MPAS-Model/cmake/PackageConfig.cmake.in
```
when `MPAS_USE_PIO=OFF` ?
I'm not sure if there is currently any use of the cmake exports other than for the JCSDA mpas-jedi project, which
AFAIK requires PIO, but cmake produces export configuration files whether or not PIO is used.
THANKS FOR YOUR HELP!
[1] https://codeberg.org/guix-science/guix-science/pulls/648
[2] MPAS Tutorial — Practice Session Guide