-
Notifications
You must be signed in to change notification settings - Fork 63
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactor NetCDF Find Module #727
Refactor NetCDF Find Module #727
Conversation
This may be mooted or simplified by #729 if that's embraced. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The main issue I see is this seems to loose parallel netcdf detection. If possible I would like that capability kept, If not simple I will approve as is.
set(NETCDF_F77 "NO") | ||
set(NETCDF_F90 "NO") | ||
find_package(NetCDF REQUIRED) | ||
find_package(NetCDF REQUIRED COMPONENTS CXX) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should probably require the C and CXX components at a minimum.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The C library isn't a component, it's the base module, so if you call find_package(NetCDF)
that only gets the C library.
function(FindNetCDF_get_is_parallel_aware include_dir) | ||
file(STRINGS "${include_dir}/netcdf_meta.h" _netcdf_lines | ||
REGEX "#define[ \t]+NC_HAS_PARALLEL[ \t]") | ||
string(REGEX REPLACE ".*NC_HAS_PARALLEL[ \t]*([0-1]+).*" "\\1" _netcdf_has_parallel "${_netcdf_lines}") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure if we want to loose parallel netcdf detection. I was planning on using parallel output for the netcdf writer.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Parallel detection is on lines 52-60.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lines 51 to 60 in b59d96a
# Check if NetCDF was built with ParallelIO support | |
file(STRINGS "${NetCDF_INCLUDE_DIR}/netcdf_meta.h" _netcdf_lines | |
REGEX "#define[ \t]+NC_HAS_PARALLEL[ \t]") | |
string(REGEX REPLACE ".*NC_HAS_PARALLEL[ \t]*([0-1]+).*" "\\1" _netcdf_has_parallel "${_netcdf_lines}") | |
if (_netcdf_has_parallel) | |
set(NetCDF_HAS_PARALLEL TRUE) | |
else() | |
set(NetCDF_HAS_PARALLEL FALSE) | |
endif() | |
unset(_netcdf_version_lines) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry I missed git was showing your entire file as a change and I did not find the string when I searched.
This PR refactors the NetCDF find module to correctly use components. The current module does not set component found vars.
Now, when configuring NGen, we should correctly see:
Changes
cmake/FindNetCDF.cmake
.Todos
Checklist
Target Environment support