Skip to content

Fix netcdf_integration CMakeList for building with netCDF package

I nao requested to merge Inao0/ovito:FixCmakeNetCDFIssue into master

I ran into a cMake error while trying to build ovito on my laptop. I'm using Manjaro and I had an issue with a netcdf target.

The error message was :

CMake Error at src/3rdparty/netcdf_integration/CMakeLists.txt:90 (GET_TARGET_PROPERTY):
 get_target_property() called with non-existent target "netcdf".

Which was corresponding to this line : GET_TARGET_PROPERTY(NETCDF_LIBRARY netcdf LOCATION)

I fixed it by changing it into the following block :

IF(TARGET netcdf)
	GET_TARGET_PROPERTY(NETCDF_LIBRARY netcdf LOCATION)
ELSE()
	GET_TARGET_PROPERTY(NETCDF_LIBRARY netCDF::netcdf LOCATION)
ENDIF()
Edited by I nao

Merge request reports