Open barriern opened 3 years ago
I have had an equivalent issue compiling v4.5.3, receiving the following error when I use CMAKE_PREFIX_PATH
CMake Error at /data/ifort_scratch/netcdf-fortran/build/CMakeFiles/CMakeTmp/CMakeLists.txt:18 (add_executable):
Target "cmTC_ea817" links to target "hdf5::hdf5_hl-shared" but the target
was not found. Perhaps a find_package() call is missing for an IMPORTED
target, or an ALIAS target is missing?
CMake Error at /data/ifort_scratch/netcdf-fortran/build/CMakeFiles/CMakeTmp/CMakeLists.txt:18 (add_executable):
Target "cmTC_ea817" links to target "hdf5::hdf5-shared" but the target was
not found. Perhaps a find_package() call is missing for an IMPORTED
target, or an ALIAS target is missing?
CMake Error at /network/software/ubuntu_bionic/cmake/3.22/share/cmake-3.22/Modules/CheckLibraryExists.cmake:72 (try_compile):
Failed to generate test project build system.
Call Stack (most recent call first):
CMakeLists.txt:624 (CHECK_LIBRARY_EXISTS)
It works fine if I switch to netCDF_LIBRARIES
and netCDF_INCLUDE_DIR
This happens with ifort 18.0.5
and gfortran 7.5.0
with cmake 3.22
on Ubunutu 18.04.
Just confirming that this is still an issue for v4.9.0, with cmake ignoring the prefix provided and linking against system versions of the libraries (I'm at a university and don't have root access). I can compile using the following,
cmake -DCMAKE_PREFIX_PATH="$LIB_DIR" \
-DnetCDF_LIBRARIES="$LIB_DIR/lib/libnetcdf.so" \
-DnetCDF_INCLUDE_DIR="$LIB_DIR/include" \
-DCMAKE_BUILD_TYPE="Release" \
-DBUILD_SHARED_LIBS=ON \
-DNC_EXTRA_DEPS=jpeg \
-DCMAKE_INSTALL_PREFIX="$LIB_DIR" \
-G "Unix Makefiles" -Wno-dev ..
Interesting, thank you for raising the profile of this, again. I'm preparing the 4.6.0 release now and will see if I can figure out what's going on. There's really not an obvious reason that it's doing this. My guess is that there is some subtlety to cmake
that I'm unaware of. Out of curiosity, what version of cmake
is being used? I'm sure it's a modern version, but the more data points, the better.
I've tried cmake 3.22.0 (installed natively) and 3.23.2 (installed within a conda environment).
Hi everyone.
I have a problem when trying to build netcdf-fortran using CMake. I use the following command:
which returns the following error:
However, when I use:
It works perfecly.
The
nc-config
command points to the right path:Could you please tell me what I am missing?
Here are my environment settings:
gcc (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0
* master f04bf72 [origin/master] Merge pull request #290 from mflehmig/mflehmig-typo_readme
* master 70862eb4 [origin/master] Merge pull request #2052 from e4t/build-fixes
cmake version 3.21.1
gcc (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0
Thanks a lot.
Nicolas