Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/fix-cmake-check-netcdf-par-heade…
Browse files Browse the repository at this point in the history
…r' into feature-CMake_CI_2
  • Loading branch information
sandro-elsweijer committed Aug 8, 2024
2 parents 46c2b3e + 357300b commit 1de492d
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 1 deletion.
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ if( T8CODE_ENABLE_NETCDF )
find_package( netCDF REQUIRED )
if(netCDF_FOUND)
message("Found netCDF")
include(cmake/CheckNetCDFPar.cmake)
endif (netCDF_FOUND)
endif( T8CODE_ENABLE_NETCDF )

Expand Down
17 changes: 17 additions & 0 deletions cmake/CheckNetCDFPar.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
include( CheckCSourceCompiles )
function( check_netcdf_par )
set( CMAKE_REQUIRED_LIBRARIES netCDF::netcdf )

check_c_source_compiles(
"
#include <netcdf.h>
#include <netcdf_par.h>
int main() {
return 0;
}
"
NETCDF_HAVE_NETCDF_PAR)
endfunction()

check_netcdf_par()
2 changes: 1 addition & 1 deletion src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ if( T8CODE_ENABLE_NETCDF )
target_link_libraries( T8 PUBLIC netCDF::netcdf )
target_compile_definitions(T8 PUBLIC
T8_WITH_NETCDF
$<$<BOOL:${T8CODE_ENABLE_MPI}>:T8_WITH_NETCDF_PAR> )
$<$<AND:$<BOOL:${NETCDF_HAVE_NETCDF_PAR}>,$<BOOL:${T8CODE_ENABLE_MPI}>>:T8_WITH_NETCDF_PAR> )
endif()

set_target_properties( T8 PROPERTIES OUTPUT_NAME t8 )
Expand Down

0 comments on commit 1de492d

Please sign in to comment.